[mapserver-users] Converting a working mapserver request to a mapcache request

Sean DiSanti mapserver at seandisanti.com
Fri Oct 17 10:04:28 PDT 2014


I have a page using esri maps that currently requests pre-generated
overlay images from a mapserver. That part is working perfectly, but now
we're looking to pass the requests through mapcache, and I'm having
trouble getting the requested tile. Any help would be greatly appreciated.
The working request to mapserver is:

http://dev.domain.com/cgi-bin/mapserv?map=/map/ahps/precip.map&shape_path=2014/10/16/nws_precip_1day_observed_20141016&mode=tile&tilemode=gmap&service=WMS&version=1.1.1&request=GetMap&Styles=default&SRS=EPSG:102100&width=256&height=256&format=image/PNG&TRANSPARENT=TRUE&layers=conus-raster&dpi=120&tile=8+12+5

and it is correctly handled by this mapfile:

MAP
	NAME "combined"
	STATUS ON

	SIZE 15000 7785
	SYMBOLSET "/shp/ahps/symbols/symbols35.sym"
	EXTENT -180 -90 180 90
	UNITS DD
	SHAPEPATH "/SHP"
	IMAGECOLOR 0 0 0
	TRANSPARENT TRUE

	#
	# Start of web interface definition
	#
	WEB
		METADATA
			"ows_enable_request" "*"
			"wms_transparent" "TRUE"
		END
	END
	#
	# Start of layer definitions
	#
	LAYER
		NAME 'conus-raster'
		TYPE RASTER
		STATUS DEFAULT
		PROJECTION
                	"init=epsg:4326"
        	END
		VALIDATION
                        "shape_path"
"^[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/nws_precip_.*_[a-zA-Z]+_[0-9]{8}"
                END
		DATA "/shp/ahps/%shape_path%_conus.png"
	END



In building the mapcache.xml file, I added a grid, source and tileset:

 <grid name="esri">
            <metadata>
            <title>GoogleMapsCompatible</title>
            </metadata>
            <extent>-180 -90 180 90</extent>
            <srs>EPSG:4326</srs>
            <srsalias>EPSG:102100</srsalias>
            <size>256 256</size>
            <units>m</units>
            <resolutions>156543.0339280410 78271.51696402048
39135.75848201023 19567.87924100512 9783.939620502561
4891.969810251280 2445.984905125640 1222.992452562820
611.4962262814100 305.7481131407048 152.8740565703525
76.43702828517624 38.21851414258813 19.10925707129406
9.554628535647032 4.777314267823516 2.388657133911758
1.194328566955879 0.5971642834779395</resolutions>
    </grid>

<source name="precip" type="wms">
        <getmap>
            <params>
                <VERSION>1.1.1</VERSION>
                <TRANSPARENT>TRUE</TRANSPARENT>
                <FORMAT>image/png</FORMAT>
                <LAYERS>conus-raster</LAYERS>
                <MAP>/map/ahps/precip.map</MAP>
                <mode>tile</mode>
                <tilemode>gmap</tilemode>
                <WIDTH>256</WIDTH>
                <HEIGHT>256</HEIGHT>
            </params>
        </getmap>
        <http>
            <url>http://mapserver.domain.com</url>
        </http>
    </source>

<tileset name="precip_tileset">
        <source>precip</source>
        <cache>disk</cache>
        <grid>esri</grid>
        <format>PNG</format>
        <metatile>5 5</metatile>
        <metabuffer>10</metabuffer>
        <expires>1</expires>
        <autoexpire>1</autoexpire>
        <dimensions>
            <dimension type="regex" name="shape_path"
default="2014/10/10/nws_precip_last180days_departure_20141010">^[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/nws_precip_.*_[a-zA-Z]+_[0-9]{8}$</dimension>
            <dimension type="regex" name="tile"
default="17+25+6">^\d{1,3}\s\d{1,3}\s\d{1,3}$</dimension>
        </dimensions>
    </tileset>


I added the tile dimension because mapserver was complaining that the tile
dimensions were not being passed, and then even after adding it, I was
getting errors that the wrong number of dimensions were being passed.  I
figured that was being caused because mapserver is expecting the value as
'tile=x+y+z' but mapcache is parsing it first and sending along 'tile=x y
z'. This was confirmed by removing the tile parameter from the call so the
default value '17+25+6' was successfully used.

I'm sorry for the book here, but I've completely run out of ideas to get
mapcache to return the same tile and figured giving too much info would be
preferably to not giving enough.  Thanks in advance for any suggestions








More information about the mapserver-users mailing list