[prev in list] [next in list] [prev in thread] [next in thread]
List: mapserver-users
Subject: Re: [mapserver-users] Single image mapfile
From: "Lime, Steve D (MNIT)" <Steve.Lime () state ! mn ! us>
Date: 2016-10-10 18:58:06
Message-ID: C549F0496453D842B4DD71AC8188DDC5193D952E () 055-CH1MPN1-042 ! 055d ! mgd ! msft ! net
[Download RAW message or body]
[Attachment #2 (text/plain)]
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=[map]&layer=myraster&mapext=[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&mode=itemquery&qlayer=myfeature&qitem=feature_id&qstring=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-bounces@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
dave@phased.co.uk<mailto:dave@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
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">It is possible but it's a two-step process within MapServer. \
It looks like so (I think):<o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText">MAP<o:p></o:p></p>
<p class="MsoPlainText"> EXTENT [bbox of whole dataset]<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"> LAYER<o:p></o:p></p>
<p class="MsoPlainText"> NAME 'myraster'<o:p></o:p></p>
<p class="MsoPlainText"> TYPE RASTER<o:p></o:p></p>
<p class="MsoPlainText"> STATUS OFF<o:p></o:p></p>
<p class="MsoPlainText"> ... stuff to draw the raster \
...<o:p></o:p></p> <p class="MsoPlainText"> END<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"> LAYER<o:p></o:p></p>
<p class="MsoPlainText"> NAME 'myfeature'<o:p></o:p></p>
<p class="MsoPlainText"> TYPE QUERY<o:p></o:p></p>
<p class="MsoPlainText"> STATUS OFF<o:p></o:p></p>
<p class="MsoPlainText"> CONNTECTIONTYPE POSTGIS<o:p></o:p></p>
<p class="MsoPlainText"> CONNECTION ...<o:p></o:p></p>
<p class="MsoPlainText"> DATA 'shape FROM (SELECT * FROM \
myfeatures) as foo USING UNIQUE feature_id'<o:p></o:p></p> <p \
class="MsoPlainText"> VALIDATION<o:p></o:p></p> <p \
class="MsoPlainText"> 'qstring' '^[0-9]{1,5}$' \
<o:p></o:p></p> <p class="MsoPlainText"> END<o:p></o:p></p>
<p class="MsoPlainText"> TEMPLATE \
'http://your_base_url_for_mapserver?mode=map&map=[map]&layer=myraster&mapext=[shpext \
expand="1000" escape="url"]'<o:p></o:p></p> <p \
class="MsoPlainText"> END<o:p></o:p></p> <p \
class="MsoPlainText">END <o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText">To make a map \
you'd issue a query against the myfeature layer.<o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText"> \
http://your_base_url_for_mapserver?map=yourmapfile.map&mode=itemquery&qlayer=myfeature&qitem=feature_id&qstring=123<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">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.<o:p></o:p></p> \
<p class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText">I've used this \
strategy before and it works well...<o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p \
class="MsoPlainText">Steve<o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText">-----Original \
Message-----<br>
From: mapserver-users [mailto:mapserver-users-bounces@lists.osgeo.org] On Behalf Of \
Dave Barter<br>
Sent: Monday, October 10, 2016 10:58 AM<br>
To: mapserver-users@lists.osgeo.org<br>
Subject: [mapserver-users] Single image mapfile</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Would this be feasible in a mapfile alone?<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I pass in a url with a feature_id in it. Say:-<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">[URL TO MAP FILE]?feature_id=124<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">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. <o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">A single jpg/tif/png would be returned with the point marked \
in the correct position on the raster<o:p></o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p \
class="MsoPlainText"><o:p> </o:p></p> <p class="MsoPlainText">This url could \
then be used on a webpage to show a small map snippet for the feature's \
location.<o:p></o:p></p> <p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Dave Barter<o:p></o:p></p>
<p class="MsoPlainText"><a href="mailto:dave@phased.co.uk"><span \
style="color:windowtext;text-decoration:none">dave@phased.co.uk</span></a><o:p></o:p></p>
<p class="MsoPlainText">@citizenfishy<o:p></o:p></p>
<p class="MsoPlainText"><a href="http://www.phased.co.uk"><span \
style="color:windowtext;text-decoration:none">www.phased.co.uk</span></a><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">_______________________________________________<o:p></o:p></p>
<p class="MsoPlainText">mapserver-users mailing list<o:p></o:p></p>
<p class="MsoPlainText"><a href="mailto:mapserver-users@lists.osgeo.org"><span \
style="color:windowtext;text-decoration:none">mapserver-users@lists.osgeo.org</span></a><o:p></o:p></p>
<p class="MsoPlainText"><a \
href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"><span \
style="color:windowtext;text-decoration:none">http://lists.osgeo.org/mailman/listinfo/mapserver-users</span></a><o:p></o:p></p>
</div>
</body>
</html>
[Attachment #4 (unknown)]
_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic