<div dir="ltr">The structural problem that you're working around is something that we solved with the query.php tool.<div><br></div><div>So query.php has a "field0" and then a "value0" field that will perform the query. We can, theoretically, migrate to a setup like that. The feature_report service was really meant to be an example of something one COULD do and less a reusable component. We could certainly evolve it as a few folks have made mention of its need.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 2, 2015 at 11:02 AM Brent Fraser <<a href="mailto:bfraser@geoanalytic.com">bfraser@geoanalytic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Dan,<br>
<br>
Good idea; we do need more user/implementer doc on Feature Reports.
But first I'd like your opinion on a small structural change to the
Feature Report service.<br>
<br>
Currently the service is defined as:<br>
<br>
<tt> <service name="feature_report" display="false"
keep-others="true"></tt><tt><br>
</tt><tt> <url>php/feature_report.php</url></tt><tt><br>
</tt><tt> <input type="hidden" name="layers"
value="lmic/fsa"/></tt></div><div bgcolor="#FFFFFF" text="#000000"><tt><br>
</tt><tt> <input type="hidden" name="src"/></tt><tt><br>
</tt></div><div bgcolor="#FFFFFF" text="#000000"><tt> <input type="hidden" name="PIN"/></tt><tt><br>
</tt><tt> </service></tt><br>
<br>
<br>
The inclusion of "PIN" identifier means that the service is specific
to a particular layer with a key attribute named "PIN". If I have
20 layers I'd like to do Feature Reports on, I'd need 20 different
services defined each with a different key name; possible but
painful.<br>
<br>
My solution is to not use the layer's key name, but use something
generic like "GM_FID", then change line 67 in feature_report.php
from:</div><div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<span><tt><span> $layer</span></tt><tt><span>-></span></tt><tt>setFilter(</tt><tt><span>str_replace</span></tt><tt>(</tt><tt><span><span>'</span>%qstring%<span>'</span></span></tt><tt>, </tt><tt><span>urldecode</span></tt><tt>(</tt><tt><span>$_REQUEST</span></tt><tt>[</tt><b><tt><span>$qItem</span></tt></b><tt>]), </tt><tt><span>$query_info</span></tt><tt><span>-></span></tt><tt>getAttribute(</tt><tt><span><span>'</span>string<span>'</span></span></tt><tt>)));</tt><br>
<br>
to<br>
</span><br>
</div><div bgcolor="#FFFFFF" text="#000000"><tt><span><span> $layer</span><span>-></span>setFilter(<span>str_replace</span>(<span><span>'</span>%qstring%<span>'</span></span>, <span>urldecode</span>(<span>$_REQUEST</span>[<b><span>'GM_FID'</span></b>]),
<span>$query_info</span><span>-></span>getAttribute(<span><span>'</span>string<span>'</span></span>)));</span></tt><br>
<br>
With those changes only one feature_report service needs to be
defined (but you would still need separate identify and report
templates for each layer, but that's ok).<br>
<br>
To really get and understanding of the problem, pick two layers in
our demo data-set and configure them to do Feature Reports (it will
all become clear).<br>
<br>
<pre cols="72">Best Regards,
Brent Fraser</pre></div><div bgcolor="#FFFFFF" text="#000000">
<div>On 6/2/2015 8:35 AM, Dan Little wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Brent, <br>
<br>
Is there any chance you can create a summarized clarification in
an RST doc or a Google doc? I'm sorry, I don't follow every post
to full understanding so if you can get something I can get more
suitable for posting on the docs website then I'll do it!
<div><br>
</div>
<div>Thanks!</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Jun 1, 2015 at 7:02 PM Brent Fraser <<a href="mailto:bfraser@geoanalytic.com" target="_blank">bfraser@geoanalytic.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Ok, as it turns out it
IS necessary to put the key name in the service definition
(so follow my instructions sent at 10:57 below). For now.
<br>
<br>
I think the fix would be fairly simple: change
feature_report.php to reference the "PID" parameter (maybe
"FID" would be a better name?).<br>
<br>
Specifically, change line 67 from:<br>
<br>
<span><tt><span>$layer</span></tt><tt><span>-></span></tt><tt>setFilter(</tt><tt><span>str_replace</span></tt><tt>(</tt><tt><span><span>'</span>%qstring%<span>'</span></span></tt><tt>,
</tt><tt><span>urldecode</span></tt><tt>(</tt><tt><span>$_REQUEST</span></tt><tt>[</tt><tt><span>$qItem</span></tt><tt>]),
</tt><tt><span>$query_info</span></tt><tt><span>-></span></tt><tt>getAttribute(</tt><tt><span><span>'</span>string<span>'</span></span></tt><tt>)));</tt><br>
<br>
to<br>
</span><tt>$layer->setFilter(str_replace('%qstring%',
$_REQUEST['PID'],
$query_info->getAttribute('string')));</tt><br>
<br>
And an implementer would now specify:<br>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><big><big><span><tr><td
align="left"><b><a href = "<a>javascript:GeoMOOSE.startService(</a></span><span>'<b>feature_report</b>'</span><span>,
{</span><span>'<b>PID</b>'</span><span> : '[</span><span>BF_ID</span><span>]',
'src' :
'Hydrography/Lakes'})">Report</a></b></td></tr></span></big></big></p>
<br>
(if the layer's unique key was named "BF_ID")<br>
<br>
<pre cols="72">Best Regards,
Brent Fraser</pre>
</div>
<div bgcolor="#FFFFFF" text="#000000">
<div>On 6/1/2015 5:15 PM, Brent Fraser wrote:<br>
</div>
</div>
<div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite"> I need to correct the information
is sent earlier. The first part of the instructions below
("Edit the feature_report service...") is not necessary as
the key field name is specified in the template
("<query item="), not the service definition.<br>
<pre cols="72">Best Regards,
Brent Fraser</pre>
<div>On 6/1/2015 10:57 AM, Brent Fraser wrote:<br>
</div>
There doesn't seem to be a lot of documentation for the
Feature Report service, so I made some notes:<br>
<span style="font-size:19px;font-family:Arial;color:#000000;background-color:transparent;font-weight:bold;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><br>
Feature Reports</span> </blockquote>
</div>
<div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">
Edit (or copy) the feature_report service in the
mapbook to add the key field, for example:</span></p>
</blockquote>
</div>
<div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite"> <br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
<service name="feature_report</span><span>_Hydrography</span><span>"
display="false" keep-others="true"></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>
<url>php/feature_report.php</url></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span> <input
type="hidden" name="layers"
value="Backgrounds/osm"/></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span> <input
type="hidden" name="src"/></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span> <input
type="hidden" name="</span><span>BF_ID</span><span>"/></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</service></span></p>
<span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><br>
<br>
</span> </blockquote>
</div>
<div bgcolor="#FFFFFF" text="#000000">
<blockquote type="cite">
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Add
the metadata to the feature’s map file:</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>METADATA</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>'identify_record'
</span><span> </span><span>'BF_HYDRO_POLYGON_identify.html'</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>'popups'
</span><span> </span><span>'BF_HYDRO_POLYGON_popups.html'</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>'feature_report'
</span><span> </span><span> </span><span>'BF_HYDRO_POLYGON_report.xml'</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
</span><span> </span><span>END # of METADATA</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Edit
the _identify template to add a link to generate and
view the report. For example my </span><span>BF_HYDRO_POLYGON_identify.html
</span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">template
has:<br>
</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span><tr><td
align="left"><b><a href = "<a>javascript:GeoMOOSE.startService(</a></span><span>'feature_report_Hydrography'</span><span>,
{</span><span>'BF_ID'</span><span> : '[</span><span>BF_ID</span><span>]',
'src' :
'Hydrography/Lakes'})">Report</a></b></td></tr></span></p>
<br>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Create
the report xml file (in my case the file is named </span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><span>BF_HYDRO_POLYGON_report.xml</span>)
modifying the key name and the PDF report name:<br>
</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
<query item="</span><span>BF_ID</span><span>"
string="%qstring%"/></span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
<!-- This is the template --></span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>
<template>BF_HYDRO_POLYGON_template.pdf</template></span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Create
the report PDF file</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">
</span><span style="font-size:15px;font-family:Arial;color:#000000;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Copy
the parcel_template.pdf to the name you entered in the
report xml file, for example:</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span>copy
parcel_template.pdf BF_HYDRO_POLYGON_template.pdf</span></p>
<pre cols="72">--
Best Regards,
Brent Fraser</pre>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Geomoose-users mailing list
<a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a></pre>
</blockquote>
</div>
_______________________________________________<br>
Geomoose-users mailing list<br>
<a href="mailto:Geomoose-users@lists.osgeo.org" target="_blank">Geomoose-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geomoose-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/geomoose-users</a></blockquote>
</div>
</blockquote>
<br>
</div></blockquote></div>