#native_company# #native_desc#
#native_cta#

GIS Mapping with PHP Page 2

By Simon Moss
on October 23, 2003

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 310×155 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.