Computer programming in PHP for business and passion
In: PHP
11 Apr 2009Today 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.

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.
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.
4 Responses to Display geographic data with PHP and Google Map
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?
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.
ask josephsen
June 10th, 2009 at 1:34 pm
Thanx
and keep up the good work
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