Forums | MacLife
You are not logged in.
#1 2008-12-10 4:15 pm
GIS and PHP
I'm looking to make maps.
Nothing too sophisticated.
Map of my county. No need for roads, though major waterways (lakes, rivers) would be nice. I'm guessing I need to find a data file somewhere and a php script that can interpret the data file (or a way to convert it into data file some php script can interpret).
The data points to be placed on it are regular hexagons. The opposing parallel sides of each hexagon is 3 miles apart.
When a piece of data is plotted, the entire hexagon gets filled in with a groovy color.
It would be nice to be able to lay a topographical map on top.
Purpose is to create range maps for local wildlife based upon volunteer user input data.
IE people spot a California Mountain Kingsnake. They take voucher photo of the snake and GPS coordinate. They enter said data into database. Entry is verified, and now the hexagon their sighting occurred in gets filled in on the range map for California Mountain Kingsnake.
Budget is low - local herp club. Purpose is noble - to help us keep track of local populations and over time if range decline is noted, we can investigate if the decline is real and why it may be happening and possibly hug some trees to help out the native species. But anyway, we really want to use open source software for this because as stated, budget is pretty much zilch.
Any pointers to software that can do this kind of thing?
I think the hexagon thing I'll have to do myself - I already have a basic algorithm figured out that will determine which hexagon a GPS coordinate belongs to, so it is just a matter of coding php to draw a filled hexagon on the map with center at a specified long/lat position.
But I know nothing about making php draw maps of any sort, I'm guessing there is probably some basic libraries out there I can use code from? Maybe some good articles?
It really does need to be database driven on the fly map generation for various reasons.
We plan on tracking birds and plants as well, as everything is related, but that part will come later - and we may ask for help with that data from local bird/botany groups.
In her right hand Jenny held the Bible of her mother
Jenny had a pistol in the other
-- Steve Taylor
Offline
#2 2008-12-23 6:23 am
Re: GIS and PHP
Well - I'm at least getting somewhere -
Google Earth -
Same data points -
I just need to figure out how the smurf to get data files for county border, lakes, rivers into a method which allows me to draw them in php.
In her right hand Jenny held the Bible of her mother
Jenny had a pistol in the other
-- Steve Taylor
Offline
#3 2008-12-23 3:33 pm
- Chickenhawk
- Snark Snark Snark Snark
- From: Being Snarky
- Registered: 2005-06-01
- Posts: 5823
Re: GIS and PHP
take a look at grass and postgis. There should be plenty of data in .shp format on the internet for borders, lakes and rivers on the internets.
edit: I don't think grass will operate as a server app, maybe geoserver? http://en.wikipedia.org/wiki/GeoServer
Last edited by Chickenhawk (2008-12-23 3:35 pm)
The recent medical controversy over whether vaccinations cause autism reveals a habit of human cognition—thinking anecdotally comes naturally, whereas thinking scientifically does not. -- Michael Shermer
Offline
#4 2008-12-24 10:26 am
Re: GIS and PHP

I'm happy.
County provides .shp files.
ogr2ogr turns them into nice .mif files.
.mif files are cake to parse and get the data from.
Now I just need to pick good colors ...
In her right hand Jenny held the Bible of her mother
Jenny had a pistol in the other
-- Steve Taylor
Offline
#5 2008-12-26 10:46 am
Re: GIS and PHP
Here's a better look -
http://homepage.mac.com/mpeters/misc/800map.png
(linked - too big for inline)
I need to add the north part of the Sac River, the Pitt River, Hat Creek, McCloud River, Fall River
I may need to buy better labeled data. The data I have (free) for rivers and lakes has 1978 polygons in it - and many of them don't have labels identifying what they are.
I wrote a script to find the largest area polygons within shasta county - which worked well for identifying which *lakes* were big enough to represent, but rivers - it seems for the most part, they are several small polygons - so without labels in the metadata, it's difficult to find the right polygons to draw them on the map.
If I buy data, there apparently is a better chance (though not guaranteed) of them being labeled.
It looks really good at 2048x - but I had to increase php's memory to get it to draw maps that big 
In her right hand Jenny held the Bible of her mother
Jenny had a pistol in the other
-- Steve Taylor
Offline
#6 2008-12-28 5:12 pm
- Chickenhawk
- Snark Snark Snark Snark
- From: Being Snarky
- Registered: 2005-06-01
- Posts: 5823
Re: GIS and PHP
check out this
http://nhd.usgs.gov/
The recent medical controversy over whether vaccinations cause autism reveals a habit of human cognition—thinking anecdotally comes naturally, whereas thinking scientifically does not. -- Michael Shermer
Offline
#8 2008-12-30 11:33 am
Re: GIS and PHP
I radically reduced the draw time by changing my SQL queries and how I process them - amazing what you can accomplish with some joins and sub query's. Not only radically reduced the hitting of the MySQL server, it considerably reduced the number of php lines as well.
In her right hand Jenny held the Bible of her mother
Jenny had a pistol in the other
-- Steve Taylor
Offline
