[Mapserver-users] How to Build Point Shapefile from MySQL with PHP_Mapscript?

Gerry Creager N5JXS gerry.creager at tamu.edu
Mon Jul 19 09:28:13 EDT 2004


I've done this for weather data using PostgreSQL, so it should be 
do-able using MySQL.

We used 2 tables: a Station table and a Data table.  Queries on the 
relatively short Station table were straightforward.  The Data table 
used an integer pointer to the Station table.  Indices for Data were the 
Station pointer and the timestamp.

The Station table includes latitude, longitude and height (OK, plus some 
other housekeeping stuff, unimportant here) and the integer pointer.

A query to the database retrieved the last set of datapoints via 
timestamp, and this is important, since the points are not all reported 
with the same timestamp, we have an interval in which they're 
acceptable, but take the most recent if more than one appears.

We generated a shapefile from the result using a perl script which I can 
provide if it'll help.

See http://mesonet.tamu.edu/currentwx.html for an example.

Gerry

BONNER S KARGER wrote:
> Since I'm not getting anywhere with the MySQL JOIN, how about building a
> shapefile/dbf from a MySQL table using PHP_Mapscript? I'm pretty sure this
> is do-able, but I can't find a good concrete example. 
> 
> I want to get
> point data from my MySQL table, create a shapefile, then have Mapserver
> display it. The layer must also be query-able, retrieving attribute data
> from either the MySQL table, or from the dbf of the newly-created
> shapefile.
> 
> Right now, I am stuck using MySQL...admin does not want to
> implement another DBMS (one that is spatially enabled). I am new to
> php_mapscript. I am using Mapserver 4.2.0, PHP 4.3.2, MySQL 3.48
-- 
Gerry Creager -- gerry.creager at tamu.edu
Texas Mesonet -- AATLT, Texas A&M University	
Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.847.8578
Page: 979.228.0173
Office: 903A Eller Bldg, TAMU, College Station, TX 77843




More information about the mapserver-users mailing list