Thursday, 20 March 2014

Filled Under:

how to get latitude and longitude from address in php

              you can easily find latitude and longitude using i am using Google Maps API to get latitude & longitude using php.just copy below code and run this code to you can easily find latitude or longitude of any address in the world.

HTML Code :

<br />
    <form name="frm" id="frm" method="post" enctype="multipart/form-data" action="get_lati_longi.php">
        Type Your Location : <input type="text" name="myaddress" />
        <input type="submit" value="get lati longi">
<br />

PHP Code :


$myaddress = urlencode($_POST['myaddress']);
$url = "$myaddress&sensor=false";
$getmap = file_get_contents($url); 
$googlemap = json_decode($getmap);

foreach($googlemap->results as $res){
     $address = $res->geometry;
     $latlng = $address->location;
     $formattedaddress = $res->formatted_address;

echo "Latitude: ". $latlng->lat ."<br />". "Longitude:". $latlng->lng; 



  1. Obviously it's hard for apprentices to not worry. The exact opposite thing you feel as a hand to hand fighting white belt is casual! Everything is new. The strategies are intense and outsider to you. What's more, odds are you aren't absolutely solid, composed and adaptable at this stage. So obviously you feel tense! For more details: