#native_company# #native_desc#
#native_cta#

GIS Mapping with PHP; Part Two Page 2

By Simon Moss
on February 9, 2004

Getting it all in.

We have downloaded an outline map of PEI from http://geogratis.gc.ca/ . I
won’t give to the exact link as its good for you to browse around and get an
idea of what data is available ( sorry, thats the school teacher in me – just
remember to look for data in GEOG format, not LAMB. I could tell you why, but
I’d have to shoot you.)
Next we have convert our E00 data into Mapinfo MIF using Mapinfos Universal
Translator ( or some free utility on the web ). Although it doesn’t really matter,
try and keep all your projections constant when converting the data. Though
in the MIF file the coordinates will look the same and will work for us, if
you use different projections it can get messy if you ever decide to edit the
files in Mapinfo at a later date.
So lets get the data into PHP. For this article our mission is to plot the location
of my house on an outline map of Prince Edward Island. Why Prince Edward Island?
Well, I live there and it is also has a smaller polygon count compared to other
provinces. I’m gonna be nice to you all …. download the PEI MIF file here.
Sit down, have a piece of cake and get ready for the next part.
At it’s most basic ( and minus a bunch of header information ) the MIF format
looks like this:
 DATA
{VECTOR TYPE} {NUMBER OF SUB-REGIONS} {POINTS IN SUB-REGION 1} {LONGITUDE} {LATITUDE} {... POINTS IN SUB-REGION 2} {LONGITUDE} {LATITUDE} {VECTOR TYPE} {NUMBER OF SUB-REGIONS}> {POINTS IN REGION} {LONGITUDE} {LATITUDE} etc etc
  ie ( a 'Region' type is basically a set of polygons )
      Region 1
  3 
  -63.778904 46.515854
  -63.790916 46.518894
  -63.796062 46.524384
  Region 2
  3 
  -63.778904 46.515854
  -63.790916 46.518894
  -63.796062 46.524384
  4
  -63.778904 46.515854
  -63.790916 46.518894
  -63.796062 46.524384
  -63.796062 46.524384

1
|
2
|
3
|
4
|
5
|
6
|
7