[Geomoose-users] Print Reports from URL

Jay Kapalczynski jkapalczynski at ci.maple-grove.mn.us
Thu Aug 20 16:31:35 EDT 2009


I know this is a long shot but thought I would try and see if anyone out there might have any thoughts...

I hope I don't make this to confusing....and hope that maybe someone might have the time to read through this.
I don't know of another way to explain what I am trying to do besides example.

I am trying to push multiple PID values into GeoMoose and then fire off the Print Report to create PDFs.
I have accomplished this from within GeoMoose while quering a database but am having issues pushing in a string from URL

I can get GM to return the PID values from the URL (single)
I can get GM to return the PID values from the URL (Multiple)
I can get GM to return the PID Values (single) from the URL and print out the single report
I cannot get GM to work with the Multiple PID from the URL values printing out multiple PDFs


EXAMPLE 1 - works
PART 1
I am using this as the URL to fire the code and open GeoMoose

http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers= Parcels&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005<http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers=%20Parcels&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005>

PART 2
In my MG_demo.xml file I created this service

<service title="ItemQueryMultiPID" default="true" visible="false">
<url>php/print_report_Auto_MultiReport_Temp.php</url>
                <input type="hidden" name="qstring"/>
</service>

PART 3
In the "print_report_Auto_MultiReport_Temp.php", which is called from the service above, I have this code

$query_string = $_REQUEST['qstring'];
$varExploded = explode(",",$query_string);

foreach($varExploded as $value)
{
  $value = trim($value);
  echo "$value<br />\n";


PART 4
Result:
In Geomoose I get an output of all the PID values, so I know I am passing in the values and parsing out the values fine.
1211922220005




'==============================================================================================

I then expand this to try and grab multiple PID Values....

'==============================================================================================

EXAMPLE 2 - works

PART 1 - notice the multiple PID values
http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers=StreetCenterlines_Shape,Centerlines,Parcels,2006%20Aerial%20Photos&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005,1211922420013,1411933120012

PART 2
<service title="ItemQueryMultiPID" default="true" visible="false">
<url>php/print_report_Auto_MultiReport_Temp.php</url>
                <input type="hidden" name="qstring"/>
                <input type="hidden" name="buffer"/>
                <input type="hidden" name="qlayer"/>
                <input type="hidden" name="title"/>
                <input type="hidden" name="layers"/>
                <input type="hidden" name="qitem"/>
</service>

PART 3  - same as above

PART 4  - same as above
In Geomoose I get an output of all the PID values, so I know I am passing in the values and parsing out the values fine.
1211922220005
1211922420013
1411933120012




Ok... so far everything is working....but what I am trying to do now is get the PrintReport to fire off....I am thinking that I can place the PrintReport.php code inside the ForEach loop while the string is being parsed.

I tried this when I was passing in only 1 PID value and IT WORKED!!!!!

http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers=StreetCenterlines_Shape,Centerlines,Parcels,2006%20Aerial%20Photos&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005<http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers=StreetCenterlines_Shape,Centerlines,Parcels,2006%20Aerial%20Photos&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005,1211922220012,1211922240014>

If I try with the second example and pass in multiple PID values it seems to get caught in the loop and do nothing.
Is there something in the PrintReport.php code that would stop the looping?
I figure if I can loop through the qstring and return the PID values I should be above to run additional code ... right?

http://127.0.0.1/geomoose/MapleGrove_demo.html?call=ItemQueryMultiPID&layers=StreetCenterlines_Shape,Centerlines,Parcels,2006%20Aerial%20Photos&title=Parcel%20Report&qlayer=Parcels&buffer=100&qitem=PID&qstring=1211922220005,1211922220012,1211922240014

THE ONLY bit of code I changed in the Print Report was to deal with the ForEach loop that parses out the PID values....: $query_string = $value; replaced  $query_string = $_REQUEST['qstring'];
This way I am using the value from the parsed qstring
That's it, other than that I just copied and pasted the code in the ForEach loop

WHY WILL IT WORK FOR ONE PID VALUE AND NOT FOR MULTIPLE...the parsing code works giving me each PID value....any thoughts as to why the PrintReport code stops running?
Are the variables for Layer, extent, title, buffer, qlayer, qitem being set to null ?????


This is the same code above from the "print_report_Auto_MultiReport_Temp.php" file.
I just put the PrintReport.php code  within the ForEach loop

I error out on this line in the printreport.php file
                                                                                                $xmlLayer = getMapLayer($mapbook, $layerTitles[$l]);

$query_string = $_REQUEST['qstring'];
$varExploded = explode(",",$query_string);

foreach($varExploded as $value)
{
  $value = trim($value);
  echo "$value<br />\n";

# THIS IS THE START OF THE PRINT_REPORT.php Code (Copied and paste din)
                                                                                # These are some global configuration details.
                                                                                #$MAPBOOK = '../rock.xml';
                                                                                $MAPBOOK = '../MapleGrove_demo.xml';

                                                                                #$SELECT_MAPFILE = '/ms4w/apps/GeoMOOSE/rock/maps_rock/select.map';
                                                                                $SELECT_MAPFILE = '/ms4w/apps/GeoMOOSE/Maple_Grove_GeoMoose/select.map';

                                                                                # Include GeoMOOSE PHP Utility Function Library
                                                                                include('geomoose_php_util.php');
                                                                                include('Configuration.php');

                                                                                # Make the PHP Script Shut Up, but still give something useful if there
                                                                                # is a legit error or parsing bug.
                                                                                error_reporting(E_ERROR | E_PARSE);

                                                                                # Include the PDF printing utility
                                                                                include('pdfprint2.php');


                                                                                $layers = $_REQUEST['layers'];                             # Comma Separated List of Mapbook Layers
                                                                                $extent = $_REQUEST['extent'];                            # Space Separated Coordinate List
                                                                                $title = $_REQUEST['title'];                   # Title for the report
                                                                                $buffer = $_REQUEST['buffer'];                             # Amount to buffer around the selected feature

                                                                                if(!isset($buffer)) { $buffer = 0; }

                                                                                $query_layer = $_REQUEST['qlayer'];
                                                                                $query_item = $_REQUEST['qitem'];

                                                                                #$query_string = $_REQUEST['qstring'];
                                                                                $query_string = $value;

                                                                # I cut out the rest of the Code in the PrintReport.php Page
} # close the ForEach loop



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20090820/84df3273/attachment.html


More information about the Geomoose-users mailing list