[CentOS] CentOS, PHP, Basic GIS

Wed Dec 24 18:07:30 UTC 2008
Michael A. Peters <mpeters at mac.com>

JohnS wrote:
> On Wed, 2008-12-24 at 03:28 -0800, Michael A. Peters wrote:
>> Michael A. Peters wrote:
>>
>>> I think I may have found what I need - I found some articles on parsing 
>>> e00 files into arrays that I can then use to draw them with gd. Now the 
>>> only issue is the e00 files I have have *too* much information - they 
>>> are statewide - so I need to figure out which datasets in the files are 
>>> the ones I want ,,,
>>>
>>> I may just write a shell script that parses the e00 file and turns the 
>>> data sets into php include files. There may be some scripts out there 
>>> that already do a similar thing I can steal, as e00 seems fairly common 
>>> and has been around awhile.
>> I think ogr2ogr does what I want - it looks like it has a driver for 
>> putting the contents of various formats into database (including MySQL 
>> which is already being used for the wildlife database) and then I can 
>> probably get the coordinates I need to draw the county border and 
>> lakes/rivers from there.
> 
> Hmm, using MySQL...You are aware that it supports High Level Graphing as of version 5.1? IMO I think your are overloading yourself in 
> PHP Code. Why not let the DB do this for you since you already have some of the data in it? You could use SPROCS and 
> Triggers to do this all. As in Plotting all your corordinates you need.

Quite possibly - but what I got works and works well now -

http://homepage.mac.com/mpeters/misc/500flags4.png

I didn't use the ogr2ogr export into MySQL - I found it (lack of my 
experience with gis no doubt) less than useful.

What I did was the following:

ogr2ogr -f "MapInfo File" FNRGC_CASIL.mif -t_srs EPSG:4326 FNRGC_CASIL.shp

The .mif file was cake to then parse with a shell script that made a 
.sql file for uploading the lon and lat

My image.php then gets those data points, converts them into x,y for use 
with php, and draws the polygon.

The downside, and where a real GIS solution would be better, is that 
distortion will be extreme near north/south poles - which is probably 
why (even though my distortion is minor give ~ 42 latitude) to be proper 
I should look for a solution that uses a real gis engine and can pick an 
appropriate projection. But this will work for now until I learn more 
about GIS. A real solution would probably make it easier for users to 
look at range map comparisons of different species etc. - either 
dynamically on the web, or by downloading our data files for their own 
GIS software. It looks like some real cool stuff could be done (IE 
comparing frog range locality data with DF&G trout stocking data, 
rainfall data, cow grazing data, whatever)

I definitely need to buy some books, and now that I have qgis installed 
and working, play with it some more.