are any way to get the latitude or longitude of a location. if yes then how.
are any way to do this using google map api.
are any way to get the latitude or longitude of a location. if yes then how.
are any way to do this using google map api.
Here is an example of how to do a request using JavaScript for Open Street Maps or Google Maps.
// GOOGLE MAPS API v3
// API: https://developers.google.com/maps/documentation/geocoding/#GeocodingRequests
// Example JSON request: http://maps.googleapis.com/maps/api/geocode/json?address=1111%20W.%2035rd%20street,%20Chicago,%20IL&sensor=true
function GoogleURI(address, type){
var uri = "http://maps.googleapis.com/maps/api/geocode/";
//address = FormatAddress(address);
if(type == "xml"){
uri = uri + type + "?" + "address=" + address + "%26sensor=false";
} else { // default to json
uri = uri + "json" + "?" + "address=" + address + "%26sensor=false";
}
return uri;
}
// OPEN STREET MAP API 0.6
// API: http://wiki.openstreetmap.org/wiki/Nominatim#Example
// Example XML Request: http://nominatim.openstreetmap.org/search?q=%201111%20W.%2035th%20Street%2C%20Chicago%2C%20IL%2060609&format=xml&addressdetails=1
// NOTE &'s and spaces dont pass easily to php and then to nominatim.openstreetmap.org
// WARNING: OPEN STREET MAPS SOMETIMES DOESNT NEED THE STATE AND ZIP CODE and in fact will error out... ;)
function OpenURI(address, type){
var uri = "http://nominatim.openstreetmap.org/search?q=";
var format = "%26format=" + type;
var details = "%26addressdetails=1";
//address = FormatAddress(address);
// NOTE: &'s dont pass good to php file_get_contents($uri) dont use "&polygon=1&addressdetails=1";
if(type == "xml"){
uri = uri + address + "%26format=" + type + "%26addressdetails=1";
} else { // default to json
uri = uri + address + "%26format=" + "json" + "%26addressdetails=1";
}
return uri;
}
You can then send the return uri from the above methods and do a GET request in PHP.
a simple method 'in browser' is just to center the map at the point you want then paste the following javascript into the address bar:
javascript:void(prompt('',gApplication.getMap().getCenter()));