You set coordinates for rectangle, language and number of cities in the array. When the script runs it outputs data for city such as latitude, longitude, population and name for first city and city names for other cities.
Check out demo
<?php require_once 'Services/GeoNames.php'; $geo = new Services_GeoNames(); $cities = $geo->cities(array( 'north' => 59, 'south' => 40, 'east' => 20, 'west' => 5, 'lang' => 'en', 'maxRows' => 3 )); print "Dump all the data for first city<br/>"; var_dump($cities[0]); print "<br/>Dump names for cities<br/>"; var_dump($cities[0]->name); var_dump($cities[1]->name); var_dump($cities[2]->name); ?>You can use this data for Google maps API.
The video shows how you can change the size of rectangle in PHP script.
No comments:
Post a Comment