[Geomoose-users] Identify upon Geocode

Jeffrey Schmitz jeffreykschmitz at gmail.com
Mon Aug 9 17:28:23 EDT 2010


Using live headers (a firefox plugin) , I was able to see an example
of how the identify tool calls identify.php:

For a point:

identify.php?layers=labels/lakes_labels:labels/counties_labels:labels/cities_labels:base_pt/cities_and_towns:urban_areas/railroad:urban_areas/roads:glifwc_base/rivers_and_streams:glifwc_base/lakes:glifwc_base/counties:glifwc_base/ceded_territories:glakes/great_lakes&shape=POINT(-10286063.071215
6018717.9989274)&_moosetime=1281388224223

For a shape:

identify.php?layers=labels/lakes_labels:labels/counties_labels:labels/cities_labels:base_pt/cities_and_towns:urban_areas/railroad:urban_areas/roads:glifwc_base/rivers_and_streams:glifwc_base/lakes:glifwc_base/counties:glifwc_base/ceded_territories:glakes/great_lakes&shape=POLYGON((-10306421.581625
5947463.2124921,-10306421.581625 6100152.0405678,-10230077.167587
6100152.0405678,-10230077.167587 5947463.2124921,-10306421.581625
5947463.2124921))&_moosetime=1281388715432

It looks like the key parts are:
layers=*path to layer*:*path to layer*:*path to layer* (each layer is
separated by a colon)
shape= either POLYGON((*four bounding coordinates separated by
commas*)) or POINT(*the point coordinates*)
_moostime= I'm pretty sure this is just a millisecond representation
of the time that the identify action occured

Don't forget to have a & between each of the variables.

Hopefully this helps you out!

-Jeff


On Mon, Aug 9, 2010 at 3:19 PM, Bill Harbour <bharbour at bcbe.org> wrote:
> Below is my geocode_pagc.php file.  I’m attempting to hit the identify
> service with the part GeoMOOSE.startService(\"identify\",{\"shape\" :
> \"POINT(\" + p.x + \" \" + p.y + \")\"})";. I know it’s working because if I
> change identify to Identify, it tells me that there’s no such service.
> Apparently I’m not sending the right string to identify.php.  Can anyone
> look over the code and give me some pointers??
>
>
>
> Thanks,
>
>
>
> Bill
>
>
>
> <?php
>
> $st_num = $_REQUEST['street_number'];
>
> $st_name = $_REQUEST['street_name'];
>
>
>
> $url =
> "http://gis_dataserver:8080/cgi-bin/geocode_response.exe?methodName=GeocodeRequest&Version=1.1&CountryCode=US&ResponseFormat=XML&RequestID=12345&maximumResponses=5&CompleteAddressNumber="
> . $st_num . "&CompleteStreetName=" . urlencode($st_name);
>
> $request_url = $url;
>
> $xmlget = file_get_contents($request_url);
>
> $replacepoint = str_replace('gml:Point','gmlPoint',$xmlget);
>
> $replacepos = str_replace('gml:pos','gmlpos',$replacepoint);
>
> file_put_contents('c:/temp/geocode_response.xml', $replacepos);
>
> $xml = simplexml_load_file('c:/temp/geocode_response.xml') or die("url not
> loading");
>
> $resolvedaddressnum =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteAddressNumber;
>
> $resolvedstreetname =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteStreetName->StreetName;
>
> $resolvedstreettype =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteStreetName->PostType;
>
> $resolvedaddress = $resolvedaddressnum . " " . $resolvedstreetname . " " .
> $resolvedstreettype;
>
>
>
> $status =
> $xml->Response->GeocodeResponse->GeocodeResponseList[numberOfGeocodedAddresses];
>
> if ($status >= 1) {
>
>       // Successful geocode
>
>       $resolvedaddressnum =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteAddressNumber;
>
>       $resolvedstreetname =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteStreetName->StreetName;
>
>       $resolvedstreettype =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->Address->SiteAddress->CompleteStreetName->PostType;
>
>       $resolvedaddress = $resolvedaddressnum . " " . $resolvedstreetname . "
> " . $resolvedstreettype;
>
>
>
> //print_r($xml);
>
>
>
> $coordinates =
> $xml->Response->GeocodeResponse->GeocodeResponseList->GeocodedAddress->gmlPoint->gmlpos;
>
>      $coordinatesSplit = split(" ", $coordinates);
>
>
>
>       // Format: Longitude, Latitude, Altitude
>
>       $lat = $coordinatesSplit[1];
>
>       $lng = $coordinatesSplit[0];
>
>
>
> $content .= "<a href='javascript:var p = new
> OpenLayers.Geometry.Point($lng,$lat);OpenLayers.Projection.transform(p,new
> OpenLayers.Projection('WGS84'),Map.getProjectionObject());GeoMOOSE.zoomToPoint(p.x,p.y,1000);GeoMOOSE.addPopup(p.x,p.y,150,50,'<b>Address
> Resolved To:</b> <br/>
> $resolvedaddress');GeoMOOSE.startService(\"identify\",{\"shape\" :
> \"POINT(\" + p.x + \" \" + p.y + \")\"});'>" . $value["address"] . "</a><br
> /><br />";
>
>
>
>  header('Content-type: application/xml');
>
>       print "<results>";
>
>       print "<script>";
>
>       print "<![CDATA[";
>
>       print "";
>
>       print "var p = new
> OpenLayers.Geometry.Point($lng,$lat);OpenLayers.Projection.transform(p,new
> OpenLayers.Projection('WGS84'),Map.getProjectionObject());GeoMOOSE.zoomToPoint(p.x,p.y,1000);GeoMOOSE.addPopup(p.x,p.y,150,50,'<b>Address
> Resolved To:</b> <br/>
> $resolvedaddress');GeoMOOSE.startService(\"identify\",{\"shape\" :
> \"POINT(\" + p.x + \" \" + p.y + \")\"})";
>
>
>
>
>
>
>
>       print "]]>";
>
>       print "</script>";
>
>       print "<html>";
>
>       print "<![CDATA[";
>
>       print "";
>
>       print "<b>Address Resolved To:</b> <br/> $resolvedaddress";
>
>       print $content;
>
>
>
>       print "]]>";
>
>       print"</html>";
>
>       print "</results>";
>
>   } else{
>
>   header('Content-type: application/xml');
>
>   print "<results>";
>
>   print "<script>";
>
>   print "</script>";
>
>   print "<html>";
>
>   print "<![CDATA[";
>
>   print "";
>
>   print "<h3><p style='color:red'>Unable to resolve address.</p></h3>";
>
>   print "]]>";
>
>   print"</html>";
>
>   print "</results>";
>
> }
>
>
>
> ?>
>
>
>
> Baldwin County Public Schools
>
> Bill Harbour
>
> GIS Coordinator
>
> Information Technology Services
>
> Baldwin County Board of Education
>
> 1071  B Ave
>
> Loxley, AL 36551
>
> V 251-580-1916
>
> F 251-972-6851
>
> Office 251-972-6850
>
> bharbour at bcbe.org
>
> http://www.bcbe.org
>
> "When life gets too unreal, sit down with a good book." - Garrison Keillor
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geomoose-users
>
>




More information about the Geomoose-users mailing list