[CentOS] CentOS, PHP, Basic GIS

Michael A. Peters mpeters at mac.com
Tue Dec 23 15:13:58 UTC 2008


Peter Hopfgartner wrote:
> Dear Micheal,
> 
> are there any good reasons not to use a normal cartesian grid? I can no 
> tremember any GIS software that can use haxagonal tiles as a raster.

What I'm doing at the moment - I input the width of the map, max/min 
lon/lat - it calculates the height of the map needed for pixels for to 
have the same pixel/kilometer ratio both north/south and east/west.

Another php function converts lat/lon coordinates to x/y coordinates 
that are oriented like gd wants them:

function getsquarelocation($lon, $lat, $maxlon, $minlon, $maxlat, 
$minlat, $width, $height) {
    $x = $width * (($lon - $minlon) / ($maxlon - $minlon));
    $y = $height * (($maxlat - $lat) / ($maxlat - $minlat));
    return array("x"=>round($x),"y"=>round($y));
    }

Obviously there's a little distortion but not much-

Sample data points in google earth: 
http://homepage.mac.com/mpeters/misc/500flags.png
Same data points in my script:
http://homepage.mac.com/mpeters/misc/500flags2.png

They look like they have the same spacial relationship to me.

So I am using cartesian coordinates, I just feed the output of that 
function to another function that finds the data points for the gd 
imagefilledpolygon and the hexagons are created. I actually have the 
hexagons overlap a tiny bit (2 pixels) to prevent a possible 1 pixel 
space between them from rounding issues.

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.

> 
> Anyway, there is quite a lot of GIS software that you can obtain via 
> EPEL [http://fedoraproject.org/wiki/EPEL].
> 
> In case you want to publish geographical informations, do yourself a 
> favor and use some of the many excellent tools out there, have a look at 
> http://www.osgeo.org. A good part of the world's leading open source GIS 
> people works on those projects.
> 
> Some, trying to summarize: If you want to keep your data on a database, 
> go with PostgreSQL and PostGIS or SQLLite with it's spatial extensions.
> 
> If you want to work with desktop applications, have a look at QGIS and, 
> at a more advanced level, GRASS.
> 
> If you want to publish your data on the web and feel more inclibned to 
> PHP then to JAVA have a look at MapServer for creating the rendered 
> images of your geographical data and to OpenLayers or Mapbender or 
> eventulally p-mapper for publishing the rendered images on the web. 
> These are the tools that we been are using here for years and your can 
> go any distance with them.

Thank you! I will look into those.



More information about the CentOS mailing list