[mapserver-users] mapcache returns error 400 bad request

Stephen Woodbridge woodbri at swoodbridge.com
Tue Mar 19 13:21:19 PDT 2013


This is one of mine:

   <source name="tiger2011" type="wms">
     <getmap>
       <params>
         <FORMAT>image/png</FORMAT>
         <MAP_IMAGETYPE>agg_qn</MAP_IMAGETYPE>
         <LAYERS>Tiger_2011</LAYERS>
         <MAP>/u/data/tiger2011-maps/tiger2011-mc.map</MAP>
       </params>
     </getmap>

     <http>
       <url>http://localhost/cgi-bin/mapserv-60</url>
     </http>
   </source>

Here is an OpenLayers app pulling tiles:

http://imaptools.com:8080/demo/tiger-demo2.html

This is what a tile request looks like:

http://imaptools.com:8080/mapcache/?LAYERS=tiger-base&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A900913&BBOX=-10018754.171394,-2504688.5428484,-7514065.6285457,2.4121254682541e-7&WIDTH=256&HEIGHT=256

Note that this is using the Google Spherical Mercator projection.

-Steve

On 3/19/2013 2:35 PM, Icadedt wrote:
> Stephen,
>
> do you have an explicit example, please?
> Does it mean i have to do apache url rewriting?
>
> my mapcache source tag is it correct? :
>
> <source name="monserv" type="wms">
>       <http>
> <url>http://localhost/cgi-bin/mapserv?</url>
>       </http>
> <getmap>
> <params>
> <FORMAT>image/png</FORMAT>
> <LAYERS>dep_point_pop</LAYERS>
> <MAP>/var/www/mapfile/dep_point.map</MAP>
> </params>
> </getmap>
> </source>
>
>
>
>
>
> ------------------------------------------------------------------------
> *De :* Stephen Woodbridge <woodbri at swoodbridge.com>
> *À :* mapserver-users at lists.osgeo.org
> *Envoyé le :* Mardi 19 mars 2013 18h34
> *Objet :* Re: [mapserver-users] mapcache returns error 400 bad request
>
> The point that Thomas is making is that mapcache understands WMS
> requests NOT mapserver cgi requests
>
> http://localhost/mapcache?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&layers=test&mode=map&map_imagetype=png&mapext=-135+0+-90+45&imgext=-135+0+-90+45&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
>
> This does not work because it is not a valid WMS request.
>
> If you go to the demo page for the WMS service, and view source, then
> you can see how to setup a OpenLayers to talk to mapcache.
>
> In FF, if you right click on the map, and select view image, you will
> see what the url for the image or tile looks like.
>
> -Steve W
>
> On 3/19/2013 1:08 PM, Icadedt wrote:
>  > HI,
>  >
>  > http://localhost/mapcache/demo works great, all the links inside work
>  > great to.
>  >
>  > even if i put out "mode=map" , i have the same error 400 'bad request'
>  >
>  > you said "make sure your mapserv+mapfile are configured for WMS access",
>  > how to check this?
>  >
>  >
>  > ------------------------------------------------------------------------
>  > *De :* thomas bonfort <thomas.bonfort at gmail.com
> <mailto:thomas.bonfort at gmail.com>>
>  > *À :* Icadedt <icadedt at yahoo.fr <mailto:icadedt at yahoo.fr>>
>  > *Cc :* "mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>"
> <mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>>
>  > *Envoyé le :* Mardi 19 mars 2013 17h08
>  > *Objet :* Re: [mapserver-users] mapcache returns error 400 bad request
>  >
>  > mapcache doesn't understand any "mode=map" mapserver queries, only WMS.
>  >
>  > - make sure your mapserv+mapfile are configured for WMS access.
>  > - test your mapcache service by going to http://server/mapcache/demo
>  >
>  > --
>  > thomas
>  >
>  > On 19 March 2013 16:55, Icadedt <icadedt at yahoo.fr
> <mailto:icadedt at yahoo.fr>
>  > <mailto:icadedt at yahoo.fr <mailto:icadedt at yahoo.fr>>> wrote:
>  >  > hi ,
>  >  > when i test this url:
>  >  >
>  >  >
>  >
> http://localhost/mapcache?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&layers=test&mode=map&map_imagetype=png&mapext=-135+0+-90+45&imgext=-135+0+-90+45&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
>  >  >
>  >  >
>  >  > i get the error 400 'bad request' ?
>  >  >
>  >  >
>  >  > my layer called 'test' comes from mapcache tileset.
>  >  >
>  >  > when i test my url without mapcache it works great:
>  >  >
>  >
> http://localhost/cgi-bin/mapserv?map=/var/www/mapfile/dep_point.map&layers=dep_point_pop&mode=map&map_imagetype=png&mapext=135+0+180+45&imgext=135+0+180+45&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
>  >  >
>  >  >
>  >  >
>  >  > Here is my mapcache.xml:
>  >  > <?xml version="1.0" encoding="UTF-8"?>
>  >  >
>  >  > <!-- see the accompanying mapcache.xml.sample for a fully commented
>  >  > configuration file -->
>  >  >
>  >  > <mapcache>
>  >  >    <cache name="disk" type="disk">
>  >  >      <base>/tmp</base>
>  >  >      <symlink_blank/>
>  >  > </cache>
>  >  >
>  >  >
>  >  >
>  >  >
>  >  > <source name="monserv" type="wms">
>  >  >      <http>
>  >  >          <url>http://localhost/cgi-bin/mapserv?</url>
>  >  >      </http>
>  >  >      <getmap>
>  >  >          <params>
>  >  >            <FORMAT>image/png</FORMAT>
>  >  >            <LAYERS>dep_point_pop</LAYERS>
>  >  >            <MAP>/var/www/mapfile/dep_point.map</MAP>
>  >  >          </params>
>  >  >      </getmap>
>  >  >    </source>
>  >  >
>  > >
>  >  >    <tileset name="test">
>  >  > <source>monserv</source>
>  >  >      <cache>disk</cache>
>  >  >      <grid>WGS84</grid>
>  >  >      <grid>g</grid>
>  >  >      <format>PNG</format>
>  >  >      <metatile>5 5</metatile>
>  >  >      <metabuffer>10</metabuffer>
>  >  >      <expires>3600</expires>
>  >  >    </tileset>
>  >  >
>  >  >
>  >  >    <default_format>JPEG</default_format>
>  >  >
>  >  >    <service type="wms" enabled="true">
>  >  > <full_wms>assemble</full_wms>
>  >  >      <resample_mode>bilinear</resample_mode>
>  >  >      <format>JPEG</format>
>  >  >      <maxsize>4096</maxsize>
>  >  >  </service>
>  >  >    <service type="wmts" enabled="true"/>
>  >  >    <service type="tms" enabled="true"/>
>  >  >    <service type="kml" enabled="true"/>
>  >  >    <service type="gmaps" enabled="true"/>
>  >  >    <service type="ve" enabled="true"/>
>  >  >    <service type="demo" enabled="true"/>
>  >  >
>  >  >    <errors>report</errors>
>  >  >    <lock_dir>/tmp</lock_dir>
>  >  >
>  > > </mapcache>
>  >  >
>  >  >
>  >  >
>  >  > this is my getcapabilities :
>  >  > http://localhost/mapcache?service=wms&request=getcapabilities
>  >  >
>  >  > returns:
>  >  >
>  >  > <WMT_MS_Capabilities
>  > version="1.1.1"><Service><Name>OGC:WMS</Name><Title>no
>  >  > title set, add some in metadata</Title><OnlineResource
>  >  >
>  >
> xlink:href="http://localhost/mapcache?"/></Service><Capability><Request><GetCapabilities><Format>application/vnd.ogc.wms_xml</Format><DCPType><HTTP><Get><OnlineResource
>  >  >
>  >
> xlink:href="http://localhost/mapcache?"/></Get></HTTP></DCPType></GetCapabilities><GetMap><Format>image/png</Format><Format>image/jpeg</Format><DCPType><HTTP><Get><OnlineResource
>  >  >
>  >
> xlink:href="http://localhost/mapcache?"/></Get></HTTP></DCPType></GetMap><GetFeatureInfo><Format>text/plain</Format><Format>application/vnd.ogc.gml</Format><DCPType><HTTP><Get><OnlineResource
>  >  >
>  >
> xlink:href="http://localhost/mapcache?"/></Get></HTTP></DCPType></GetFeatureInfo></Request><Exceptions><Format>text/plain</Format></Exceptions><VendorSpecificCapabilities><TileSet><SRS>EPSG:4326</SRS><BoundingBox
>  >  > SRS="EPSG:4326" minx="-180.000000" miny="-90.000000" maxx="180.000000"
>  >  > maxy="90.000000"/><Resolutions>0.70312500000000000000
>  > 0.35156250000000000000
>  >  > 0.17578125000000000000 0.08789062500000000000 0.04394531250000000000
>  >  > 0.02197265625000000000 0.01098632812500000000 0.00549316406250000000
>  >  > 0.00274658203125000000 0.00137329101562500000 0.00068664550781250000
>  >  > 0.00034332275390625000 0.00017166137695312500 0.00008583068847656250
>  >  > 0.00004291534423828120 0.00002145767211914060 0.00001072883605957030
>  >  > 0.00000536441802978516
>  >  >
>  >
> </Resolutions><Width>256</Width><Height>256</Height><Format>image/png</Format><Layers>test</Layers><Styles/></TileSet></VendorSpecificCapabilities><Layer><Name>rootlayer</Name><Title>no
>  >  > title set, add some in
>  >  >
>  >
> metadata</Title><SRS>EPSG:900913</SRS><SRS>EPSG:4326</SRS><SRS>EPSG:3857</SRS><Layer
>  >  > cascaded="1" queryable="0"><Name>test</Name><LatLonBoundingBox
>  >  > minx="-180.000000" miny="-90.000000" maxx="180.000000"
>  >  > maxy="90.000000"/><BoundingBox SRS="EPSG:4326" minx="-180.000000"
>  >  > miny="-90.000000" maxx="180.000000"
>  >  > maxy="90.000000"/><SRS>EPSG:4326</SRS><BoundingBox SRS="EPSG:900913"
>  >  > minx="-20037508.342789" miny="-20037508.342789" maxx="20037508.342789"
>  >  >
>  >
> maxy="20037508.342789"/><SRS>EPSG:900913</SRS><SRS>EPSG:3857</SRS></Layer></Layer></Capability></WMT_MS_Capabilities>
>  >  >
>  >  >
>  >  >
>  >  >
>  >  > Thanks in advance
>  >  >
>  >  > _______________________________________________
>  >  > mapserver-users mailing list
>  >  > mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>
> <mailto:mapserver-users at lists.osgeo.org
> <mailto:mapserver-users at lists.osgeo.org>>
>  >  > http://lists.osgeo.org/mailman/listinfo/mapserver-users
>  >  >
>  >
>  >
>  >
>  >
>  > _______________________________________________
>  > mapserver-users mailing list
>  > mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
>  > http://lists.osgeo.org/mailman/listinfo/mapserver-users
>  >
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org <mailto:mapserver-users at lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>



More information about the mapserver-users mailing list