Jayant's Blog

Saturday, August 09, 2008

Using Php with ArcGIS Server 9.3 REST (v0.02)

One of the powers of using GIS is that in addition to tabular data you also have access to spatial data as part of each record. So in the following Php code, I will query to find 'Los Angeles' and simple display the result with the coordinates of the city.

<?php
$url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services" . "/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0/query" . "?f=json&where=CITY_NAME='Los+Angeles'";
$response = file_get_contents($url);
$json = json_decode($response);

$la = $json->features[0];
echo $la->attributes->CITY_NAME . " (" . $la->geometry->x . ", " . $la->geometry->y . ")";
?>

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<$I18N$LinksToThisPost>:

Create a Link

<< Home