| Author |
Message |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 14/01/2008 14:48:26
|
nicarcola
Joined: 06/02/2007 12:13:27
Messages: 26
Offline
|
Is there an example how to use reverse geocoding like nearbyplaces in php?
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 15/01/2008 21:03:49
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4501
Offline
|
I don't have an example for the geonames services. You find a lot of other examples and tutorials on the web :
http://search.yahoo.com/search?p=php+rest
This should help you to get started.
Cheers
Marc
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 16/01/2008 19:42:50
|
nicarcola
Joined: 06/02/2007 12:13:27
Messages: 26
Offline
|
I just want to know hoe the http regquest looks like in php and how I get my information returned.
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 17/01/2008 13:35:12
|
geotree
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline
|
Example using PHP 5
Code:
$url = "http://ws.geonames.org/hierarchyJSON?geonameId=6447142";
$json = file_get_contents($url);
$data = json_decode($json, true);
var_dump($data);
Note : json_decode() does not exist using PHP4
|
Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 17/01/2008 21:09:46
|
nicarcola
Joined: 06/02/2007 12:13:27
Messages: 26
Offline
|
Thanks. But with reverse geocoding I have a lat and lng. Where do I put this information in the url and how do I refer to the city, province, country and countrycode?
Nico.
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 17/01/2008 21:31:04
|
geotree
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline
|
Use lat= and long= parameters
Code:
$url = "http://ws.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9"
$json = file_get_contents($url);
$data = json_decode($json, true);
foreach ($data["geonames"] as $key => $val) {
echo $val["name"]." ".$val["countryName"]." ".$val["countryCode"]."<br />";
}
|
Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 21/01/2008 12:21:23
|
nicarcola
Joined: 06/02/2007 12:13:27
Messages: 26
Offline
|
When I test this code I get the following error???
Parse error: syntax error, unexpected T_VARIABLE in .... on line 2
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 21/01/2008 12:43:16
|
geotree
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline
|
Just add a missing ; to the first line.
|
Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 08/02/2012 06:09:36
|
kumarpavan48
Joined: 07/02/2012 15:11:55
Messages: 2
Offline
|
Can u Help me I have List of Latitude, Longitude, in mysql database .....Let me know how can i get the mysql data as output by getting in a map.....
$url = "http://ws.geonames.org/findNearbyPlaceNameJSON?lat=17.24&lng=78.18";
$json = file_get_contents($url);
$data = json_decode($json, true);
foreach ($data["geonames"] as $key => $val) {
echo $val["name"]." ".$val["countryName"]." ".$val["countryCode"]."<br />";
}
My Goal was to Show Address (Locaton,counrty,code) on map By using My Mysql DAta base any one plzz help me this is my acdemic project time only two days
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 08/02/2012 06:09:36
|
kumarpavan48
Joined: 07/02/2012 15:11:55
Messages: 2
Offline
|
canu plz help in reverse geocoding!!!
|
|
|
 |
|
|