<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:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@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;}
@font-face
{font-family:"Comic Sans MS";
panose-1:3 15 7 2 3 3 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.apple-tab-span
{mso-style-name:apple-tab-span;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">You don’t need to do runtime substitution with an itemquery, MapServer will extend the where clause automatically. You data statement just needs to look like:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">
</span>DATA "wkb_geometry from (select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly) as subquery using unique objectid srid=200068"<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Basques, Bob (CI-StPaul) [mailto:bob.basques@ci.stpaul.mn.us]
<br>
<b>Sent:</b> Thursday, July 13, 2017 10:24 AM<br>
<b>To:</b> Lime, Steve D (MNIT) <steve.lime@state.mn.us><br>
<b>Cc:</b> Stephen Woodbridge <woodbri@swoodbridge.com>; mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] Zoom to something and display in one shot from MapServer CGI.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Working on this, but not quite there yet . . .<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">My initial request looks like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?">http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> mode=itemquery&<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> qlayer=Parcels-Map-Query&<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> qitem=parcelid&qstring=162823340026&<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> WIDTH=1069&HEIGHT=917<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I get a “no matching records” found . . . and with DEBUG 5 on the query layer . . .<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> CONNECTIONTYPE PostGIS<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> CONNECTION “host=localhost dbname=postgres user=mapserv password=****”<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> DATA "wkb_geometry from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '%qstring%') as subquery using unique objectid srid=200068"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> VALIDATION<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> 'pin' '^[0-9]{12}$'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> 'qstring' '^[0-9]{12}$'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> END<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645602 msPostGISGetPaging called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645665 msPostGISLayerIsOpen called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645672 msPostGISLayerFreeItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645675 msPostGISLayerClose called: wkb_geometry from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645680 msPostGISLayerOpen called: wkb_geometry from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].645686 msPostGISLayerOpen: No connection in pool, creating a fresh one.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].654626 msConnPoolRegister(Parcels-Map-Query,host=localhost dbname=postgres user=mapserv password=****,0x191b510)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659333 msPostGISLayerOpen: Got PostGIS version 20200.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659343 msPostGISLayerOpen: Forcing 2D geometries: yes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659347 msPostGISEnablePaging called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659349 msPostGISLayerIsOpen called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659354 msPostGISLayerFreeItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659359 msPostGISLayerFreeItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659364 msPostGISLayerGetItems called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659368 msPostGISParseData called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659378 msPostGISParseData: unique_column=objectid, srid=, geom_column_name=wkb_geometry, table_name=(<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].659384 msPostGISLayerGetItems executing SQL: select * from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery where false limit 0<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666373 msPostGISLayerInitItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666385 msPostGISLayerInitItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666397 msPostGISLayerIsOpen called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666403 msPostGISLayerWhichShapes called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666406 msPostGISParseData called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666413 msPostGISParseData: unique_column=objectid, srid=, geom_column_name=wkb_geometry, table_name=(<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666417 msPostGISBuildSQL called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666419 msPostGISBuildSQLItems called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666422 msPostGISBuildSQLItems: 2 items requested.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666426 msPostGISBuildSQLFrom called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666429 msPostGISBuildSQLWhere called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666432 msPostGISBuildSQLSRID called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666435 msPostGISBuildSQLSRID: Building find_srid line.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666438 msPostGISBuildSQLBox called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:00 2017].666459 msPostGISLayerWhichShapes query: select "objectid","parcelid",encode(ST_AsBinary(ST_Force2D("wkb_geometry"),'NDR'),'hex') as geom,"objectid" from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery where wkb_geometry && ST_GeomFromText('POLYGON((573387 162092,573387 162555,574211 162555,574211
162092,573387 162092))',find_srid('','cache.rc_parcel_poly','wkb_geometry')) and ("parcelid"::text = '162823340026')<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114391 msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114407 msPostGISLayerWhichShapes got 0 records in result.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114412 msPostGISLayerNextShape called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114416 msPostGISLayerFreeItemInfo called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114419 msPostGISLayerClose called: wkb_geometry from (<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> select objectid, parcelid, wkb_geometry from cache.rc_parcel_poly where parcelid = '%pin%' or parcelid = '162823340026') as subquery using unique objectid srid=200068<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114443 msConnPoolRelease(Parcels-Map-Query,host=localhost dbname=postgres user=mapserv password=****,0x191b510)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114447 msConnPoolClose(host=localhost dbname=postgres user=mapserv password=****,0x191b510)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114546 msQueryByFilter(): Search returned no results. No matching record(s) found.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114657 freeLayer(): freeing layer at 0x18e8a40.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[Thu Jul 13 09:30:01 2017].114661 msPostGISLayerIsOpen called.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The subquery works fine from sql and returns a single record. One thing I noticed, is that the POLYGON BBOX is way off to the west a few thousand feet. There is no default image size in the Mapfile either so I don’t know where that number
is coming from other than shpext . . . are there other parameters that need to be added to the shpext call?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">the TEMPLATE link looks like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> TEMPLATE '<a href="http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?pin=162823340026&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&LAYERS=all&_OLSALT=0.7873164216111053&SRS=EPSG%3A200068&BBOX=%5bshpext">http://gis.ci.stpaul.mn.us/datasets/PUBLIC/LAND_OWNERSHIP/PARCELS/rc_parcels_assessment.map?pin=162823340026&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&LAYERS=all&_OLSALT=0.7873164216111053&SRS=EPSG%3A200068&BBOX=[shpext</a>
format="$minx,$miny,$maxx,$maxy"]&WIDTH=1069&HEIGHT=917'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This will (should) return an image, should it be some sort of text return instead? I’m trying to keep it WMS too . . . is this still doable??<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal">bobb<o:p></o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Jul 12, 2017, at 10:41 AM, Lime, Steve D (MNIT) <<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The shpext tag can re-project, format and buffer a shapes extent if that helps.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span><o:p></o:p></p>
</div>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span class="apple-converted-space"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Basques,
Bob (CI-StPaul) [<a href="mailto:bob.basques@ci.stpaul.mn.us">mailto:bob.basques@ci.stpaul.mn.us</a>]<span class="apple-converted-space"> </span><br>
<b>Sent:</b><span class="apple-converted-space"> </span>Wednesday, July 12, 2017 8:37 AM<br>
<b>To:</b><span class="apple-converted-space"> </span>Lime, Steve D (MNIT) <<a href="mailto:steve.lime@state.mn.us">steve.lime@state.mn.us</a>><br>
<b>Cc:</b><span class="apple-converted-space"> </span>Stephen Woodbridge <<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>>;
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b><span class="apple-converted-space"> </span>Re: [mapserver-users] Fwd: Zoom to something and display in one shot from MapServer CGI.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Steve (L),<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">That’s really close to what I was looking for. I vaguely remembered something going on enhancement wise, related to URL requests inside of a MapServer request.<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">I’ll try this out and get back here with the results.<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">bobb<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333;background:white"><br>
"I like nonsense; it wakes up the brain cells."</span><span style="font-size:9.0pt;font-family:"Comic Sans MS";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333;background:white">- Dr. Seuss</span><span style="font-size:9.0pt;font-family:"Comic Sans MS";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Comic Sans MS";color:black"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Comic Sans MS";color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>