Get Latitude and Longitude from your Postal Address

We generally do not know the latitude and longitude of our area or any other area if we have needed to get the information. Sometimes we have to Google for getting this information. It is not a big issue to find out the approximate latitude  and longitude for any location and it can easily be done in PHP.


Here I am writing the procedures to do the same.

1. Create a PHP page say ‘postal_lang_long.php’

2. Put the following codes in the PHP file.

if ($_REQUEST[where]) {
$where = stripslashes($_REQUEST[where]);
$whereurl = urlencode($where);
// Note - Google key is domain specific!
$location = file("$whereurl
// Sample - $location[0]="200,8,51.369318,-2.133457";
list ($stat,$acc,$north,$east) = explode(",",$location[0]);
$html = "Information for ".htmlspecialchars($where)."
$html .= "North: $north, East: $east<br>";
$html .= "Accuracy: $acc, Status: $stat<br>";
} else {
$html = "Space reserved for your report when form completed";
<title>Postal Address to Latitude / Longitude</title>
<body bgcolor="#99CCFF"></pre>
<div align="center">500px;"></div>
Enter a place name / address and a latitude and longitude will be returned.
<form method=post>Place: <input type="text" name="where" size="40" />
<input type=submit value=go></form>

3. Now place your PHP file in your web server and open the file in any browser.
4. Now in your browser you can see a text box asking for the name of the place.
5. Enter the place-name and hit ‘go’ button.
6. That’s all, you will be shown the latitude and longitude of your location.

  • Aaron<span class="comment-author-location"> from Queens Village, NY, United States</span>

    Hi there. Great tute! Very useful. I was wondering, if I wanted to use this in my application, should I sign up for my own Google API Key? Or what is the legality of using the same key over and over for multiple websites, say in a template?

    • admin<span class="comment-author-location"> from Kolkata, Bengal, India</span>

      @Aaron, thanks for your reply. It is recommended to signup Google API separately for different website.

  • Yahwe<span class="comment-author-location"> from Ashburn, VA, United States</span>

    How much is a link to your site? My site

  • Gowtham<span class="comment-author-location"> from India</span>

    Its really usefull to me…. Thanks for sharing…

  • Ruthie Marreel<span class="comment-author-location"> from United States</span>

    One again, your article is very nice

  • Seb<span class="comment-author-location"> from Maidenhead, Windsor and Maidenhead, United Kingdom</span>

    This is fantastic – I've been looking for some solutions for getting lat and long from the post code, but this one is the top-notch one. Thanks for sharing!

  • Lacey Gelber<span class="comment-author-location"> from Kemerovo, Kemerovo, Russian Federation</span>

    This is really great content material. Thank you with this.

  • Dovie Goth<span class="comment-author-location"> from Greece</span>

    hello bros!! Amazing site!

  • klamki do okien<span class="comment-author-location"> from Kepong, Selangor, Malaysia</span>

    Hey there, You've done a fantastic job. I’ll definitely digg it and personally suggest to my friends. I'm confident they will be benefited from this website.

  • Jayne Kaller<span class="comment-author-location"> from New Delhi, Delhi, India</span>

    Good job, post is fantastic

  • Claudio Soderquist<span class="comment-author-location"> from Chicago, IL, United States</span>

    Which i dont write-up in Information sites but your site required myself for you to, astounding get the job done. attractive.

  • Ev Temizlik<span class="comment-author-location"> from Portugal</span>

    Great blogging. Keep it up ;) Btw i found my self here while i was searching for "temizlik sirketleri antalya"

  • Romeo Tanksley<span class="comment-author-location"> from Lima, Lima, Peru</span>

    Hi,this article is great,I found it on google and I appreciate it very much,I agree with what you have said, it help me a lot in decision,but I still have some questions with the last part,can you explain it for me ?I will appreciate your answer,and I will be back again!

  • Malena Damewood<span class="comment-author-location"> from Germany</span>

    I appreciate, cause I found exactly what I was looking for. You have ended my four day long hunt! God Bless you man. Have a nice day. Bye

  • Nauka jezyka angiels<span class="comment-author-location"> from Germany</span>

    It is really a great and helpful piece of info. I am glad that you shared this useful information with us. Please keep us informed like this. Thank you for sharing.

  • Kathaleen Folliard<span class="comment-author-location"> from Gandul, Central Java, Indonesia</span>

    Great write-up, I am normal visitor of one's website, maintain up the nice operate, and It is going to be a regular visitor for a lengthy time.

  • Marta Sonseca<span class="comment-author-location"> from Atlanta, GA, United States</span>

    Hey! I just want to give a huge thumbs up for the great information you have got here on this post. I can be coming again to your weblog for extra soon.

  • Mark Sierzenga<span class="comment-author-location"> from Brazil</span>

    This is all very new to me and this article really opened my eyes.Thanks for sharing with us your wisdom.

  • Leroy Cousino<span class="comment-author-location"> from Patos, Minas Gerais, Brazil</span>

    excellent points altogether, you simply gained a new reader. What would you suggest about your post that you made a few days ago? Any positive?

    • admin<span class="comment-author-location"> from India</span>

      Hi Leroy, for which post are you talking about? If you want to share anything else, you can write here or just go to our contact page and write your valuable comments. I will be happy to hear from you.

  • Scottie Lefevers<span class="comment-author-location"> from Dallas, TX, United States</span>

    This online internet site carries a pretty good offer of pretty good right lower to earth well finding tips also it will require to hold out tremendously well, if it hasn’t already? I appreciated studying about some even though implementing products!

  • Jamison Haws<span class="comment-author-location"> from Dallas, TX, United States</span>

    I apperceive i am a smaller away topic, but i just funds to say i adulation the blueprint within the blog. i am new in the route of blogegine platform, so any tips on accepting my internet page analytic good is often appreciated.

  • Marlene Dull<span class="comment-author-location"> from Dallas, TX, United States</span>

    This is all very new to me and this article really opened my eyes.Thanks for sharing with us your wisdom.

  • Buford Beagan<span class="comment-author-location"> from Germany</span>

    It’s hard to find knowledgeable people on this topic, but you sound like you know what you’re talking about! Thanks

  • Matt Riske<span class="comment-author-location"> from Seattle, WA, United States</span>

    I'm not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later on and see if the problem still exists.

    • admin<span class="comment-author-location"> from India</span>

      Hi Matt, I think there are some issues at your end. This website is designed and coded such a way to load faster. There is no external script called and I tried to maintain it simplistic look. If you find this issue later too, please feel free to write is from our contact page.

  • admin<span class="comment-author-location"> from India</span>

    Hi, this is designed & developed by my team. We are a web development company. We provide web based services. For any future assistance, you can write us from our contact page. We will be happy to assist you.

  • admin<span class="comment-author-location"> from India</span>

    Hi, thanks for your comments. You can sign up for our blog update through e-mail and you can find it in the footer area. So, when ever I update any post, you will be notified through e-mail.