How to convert postcode to Geolocation (latitude & longitude) using google maps api?

25,476

You can do this using google map Geocoding API. Please find below example, but to correct latitude/longitude and address you need to pass full address along with zipcode.

For more detail please click on below link:

http://code.google.com/apis/maps/documentation/geocoding/

<?php
$url ="http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false";
$result = simplexml_load_file($url);
print"<pre>";
print_r($result);
?>
Share:
25,476
Peeyush
Author by

Peeyush

#Code,#Developer,#Traveller,#ShutterBug

Updated on July 09, 2022

Comments

  • Peeyush
    Peeyush almost 2 years

    I just want to get latitude & longitude using the post code with Google maps API.

    I am using PHP for development.

    How can I do this?

    The post code can be from any where in this world.