Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

GIS Mapping with PHP
Finding your place in this world
To plot an object on any map, be it a house or a herd of caramelized Wombats, the object needs to be geocoded - that is have a map coordinate allocated to it. For all examples we used a standard longitude (long) and latitude (lat) coordinate. There a numerous other coordinate systems out there - some a lot more accurate, but this is the most common, the easiest to plot and suits our needs. The downside of directly plotting long/lat coordinates is that you will get distortion as you near the poles. However, for our uses this doesn't pose a problem.
The two coordinates of a longitude and latitude refer to the angle in degrees from the equatorial plane of the earth, both up and down. Longitude lines extend from pole to pole giving us an "X" coordinate, Latitude lines give us the "Y" coordinate. These can either be written as a decimal value ( ie 23.323232 ) or as degrees, minutes and seconds ( D'M'S ). For storing our coordinates we used the decimal version as it's a lot easier and saves a lot of processing time. There are a number of sites with Javascript utilities which will convert coordinates from D'M'S ( degrees, minutes and seconds ) to the decimal format. I happen to use a Sharp EL-546 scientific calculator which has the function built in.
There are a number of ways to finding the long/lat of a point in the world, however a quick and easy way is to used Microsofts online GIS service Mappoint ( www.mappoint.com ). Find your location using Mappoint search utilities and make sure it is in the center of the map. Right mouse click on the map, and you will find long/lat coordinates embedded in the URL of the map image. It is also worth looking at www.geogratis.com, plus a number of government operated environmental sites will have map data which you can download for free. Those of you who have Mapinfo will also find very useful geocoded data on the sample discs which come with it.
The point we are plotting for this article is my 64 bedroom mansion, located in the bustling urban metropolis which is Prince Edward Island, Canada. Using Mappoint I have discovered my location is:
Longitude: -63.10774861954596
Latitude: 46.2899306519141
We now need a base map to plot our point on. In future articles we will generate this ourselves, however to start we will use a simple pre drawn JPG file. The base map we are using is called earth_310.jpg, and is and view of the earth in what is called a Cylindrical projection.
map of the world
The original of this image can be found in various forms all over the web in various sizes and scales. A cylindrical projection is the simplest projection to plot long/lat coordinates onto, again with a minimum of conversion needed reducing processor overhead. For our purposes you can simply right click the image and "Save picture as ..." to your hard drive.
The base map is scaled to 310x155 for ease of use, but you can rescale this map to any size.
We are now ready to generate the code to plot our point.
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
Firm Foundation Adam 05/30/08 03:28
Thanks for the basics!Rob A10/26/05 15:13
Nice article but....Patrik08/21/05 20:07
Ä«/µå/µ¹·Á¸·±â·Î/¸Á°¡Áö½ÅºÐ/²À º¸¼¼¿ä!ÀÌÇýÁø12/01/04 12:32
´ë'Ãâ'°Å'Àý'½Ã'100%µÇ'°Ô'ÇÏ'´Â'¹æ'¹ýÇѰæ¿í11/29/04 09:51
Edit Map Oracle Spatial Beny11/23/04 12:04
Ä«/µå/µ¹·Á¸·±â·Î/¸Á°¡Áö½ÅºÐ/²À º¸¼¼¿ä!ÀÌÇýÁø11/23/04 07:30
´ë'Ãâ'°Å'Àý'½Ã'100%µÇ'°Ô'ÇÏ'´Â'¹æ'¹ýÇѰæÇý11/19/04 01:59
½Å.¿ë.ºÒ.·®.ÀÚ/´çÀÏ500/´ë.Ãâ.ºñ.¹ýÀÌÈñÁø11/18/04 08:50
5.ºÐ.¸¸¿¡ 4.0¸¸.¿ø ¹«,ÀÌ.ÀÚ·Î ºô.¸®±âÁö¿µÈñ11/18/04 08:34
½Å.¿ëºÒ.·®ÀÚ°¡ ¾Ë¾Æ¾ßÇÒ Á¤.º¸ ´ë.°ø.°³ ÀÌ´ÙÁø11/15/04 21:26
10_ºÐ¾È¿¡ Çö.±Ý40¸¸_¿ø ¸¸.µé,±âÀÌÁ¤¿¬11/15/04 01:06
thank'syoga firmansyah09/17/04 09:05
Works like a charmthomas09/09/04 08:35
RE: Great article, extra exampleGlenn06/11/04 05:00
Great article, extra exampleErik Spithoven05/24/04 07:47
GD LibrairyDeckard02/26/04 01:51
RE: Part IIGlenn02/02/04 06:16
PHP / GIS needs the punchJoão Pinheiro12/31/03 10:43
Great!!Ruben12/31/03 04:36
RE: Part IISimon12/28/03 17:28
Part IIJIm12/22/03 10:30
Geocoding in PHPRon11/28/03 06:46
Gis Mapping with PHPDavid11/23/03 01:05
Corrections to codeDave Messer11/17/03 13:56
Very helpful!Lee11/14/03 02:05
Informative ArticleDavid Snow11/09/03 07:36
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.