Display geographic data with PHP and Google Map

In: PHP

11 Apr 2009

Today i created an example in PHP to display data into a Google map. I used my GMaps class (see my previous post) to retrieve geographic information for all the provinces of Italy, as you know i’m italian. I inserted all the data into a table of MySQL with the following fields: id, province, code, area, latitude, and longitude where code is the italian automobile code and area is the name of the region. For instance the province of Pescara has the following record: 69,’Pescara’,'PE’, ‘Abruzzi’, 42.4648, 14.2141.

Provinces of Italy



The example in PHP uses this database to display the geographic data of all the provinces of Italy. You can select the geographic area (region) in a combobox and display the data on a Google Map.

You can download the source code of the example with the database here.

Click here to see the online example.

4 Responses to Display geographic data with PHP and Google Map

Avatar

Ask Josephsen

June 10th, 2009 at 8:26 am

Very cool. And a nice GMaps.php-class as well. How did you retrieve the data about the cities within each province?

Avatar

Enrico Zimuel

June 10th, 2009 at 8:59 am

I used an italian MySQL database contains all the cities, provinces and regions. Using the Google Map API i have completed the database with the geographic informations (latitude, longitude). If you need some informations about the city of a province you have to use a database, you can’t query the Google Map for this scope. I found some specific databases in internet, for instance this of the EU http://www.unece.org/etrades/download/downindex.htm.
Unfortunatly I didn’t found any free database of the world.

Avatar

ask josephsen

June 10th, 2009 at 1:34 pm

Thanx :) and keep up the good work

Avatar

Fabio Salvo

July 8th, 2010 at 4:46 pm

Hi Enrico,
congrats for your interesting blog. I am trying to develop a RE database for Italy and need the lat&long database for it. I need it at Neighborhood basis, so it must be possible from a given lat&long coordinate to recognize the place and, for cities, the neighborhood (ex. Parioli, EUR, Trastevere for Rome).
Where can I find it? How does it work?
Thanks a lot in advance!
Fabio

Comment Form

About this blog

This is my personal blog about computer programming in PHP for business and passion. I'm Enrico Zimuel a Software Engineer since 1996. I work as Senior Consultant & Architect at Zend Technologies. For more info about me visit my web site.

PHP 5 Zend Certified Engineer Zend Framework Certified Enginner

My next conferences


PHP Barcelona Conference 2010

WebTech Conference 2010
  • Enrico Zimuel: Hi David, unfortunately the i5_spool can manage only strings, no images. If you need to convert comp [...]
  • David Porter: Zimuel, Thanks for the Spool Class and information on using the i5 Toolkit for strong i5/OS inter [...]
  • ninon: Hi!! thanks for your article, it's been so useful to me. I'm novice in zend and I've a doubt. I ha [...]
  • snow boots: Using the Google Maps API you can easly compare the data stored into your database with the google d [...]
  • Enrico Zimuel: To use the ZendAPI_Queue you have to run your PHP application using Zend Platform (http://www.zend.c [...]
follow me on twitter