It is possible but it's a two-step process within MapServer. It looks like so
(I think):
MAP
EXTENT [bbox of whole dataset]
LAYER
NAME 'myraster'
TYPE RASTER
STATUS OFF
... stuff to draw the raster ...
END
LAYER
NAME 'myfeature'
TYPE QUERY
STATUS OFF
CONNTECTIONTYPE POSTGIS
CONNECTION ...
DATA 'shape FROM (SELECT * FROM myfeatures) as foo USING UNIQUE feature_id'
VALIDATION
'qstring' '^[0-9]{1,5}$'
END
TEMPLATE
'http://your_base_url_for_mapserver?mode=map=[map]=myraster=[shpext
expand="1000" escape="url"]'
END
END
To make a map you'd issue a query against the myfeature layer.
http://your_base_url_for_mapserver?map=yourmapfile.map=itemquery=myfeature=feature_id=123
The query does an item query against the myfeature where feature_id=123. The
validation block allows you to limit values for the feature_id. The TEMPLATE
then determines where MapServer should redirect the request based on the
selected feature – this gets you the right map. The shpext tag will take the
point geometry extent (minx=maxx and miny=maxy) and then expands it by 1000 map
units before returning the string as a space delimited (and escaped) extent.
I've used this strategy before and it works well...
Steve
-Original Message-
From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On
Behalf Of Dave Barter
Sent: Monday, October 10, 2016 10:58 AM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Single image mapfile
Would this be feasible in a mapfile alone?
I pass in a url with a feature_id in it. Say:-
[URL TO MAP FILE]?feature_id=124
The map file uses a postgres query to retrieve the feature_id’s geometry as a
point and then clips a raster layer to a kilometre bounding box around the
point.
A single jpg/tif/png would be returned with the point marked in the correct
position on the raster
This url could then be used on a webpage to show a small map snippet for the
feature’s location.
Dave Barter
d...@phased.co.uk<mailto:d...@phased.co.uk>
@citizenfishy
www.phased.co.uk<http://www.phased.co.uk>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users