shpcreate & shpadd

Stephen Lime steve.lime at dnr.state.mn.us
Fri Dec 22 08:54:27 PST 2000


 There's no way to avoid disk activity. You can use mapscript to do this pretty easily. 
The algorithm is:

1) create new shapefile and dbf file
2) query mysql
3) for each result write a shape and an attribute record
4) close/save the files

No more than 30 lines of code.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Kieran J. Ames" <kames at keyspanenergy.com> 12/19/00 10:14AM >>>
Hello all,
I'm looking to create some point layers from a MySQL db that has lat/lon
entries. I wanted to use mapscript, but there is more than a 3 minute
lag in retreiving the data from the db.
(I've heavily indexed the db, but calls like "where LAT BETWEEN
south_value AND north_value AND LON BETWEEN west_value AND east_value"
return about 500 records out of a possible 1.8 million.) Therefore, I
thought I'd do some pre-processing and have some layers already
available... trading disk space for speed.
I've used shpcreate and shpadd to make the layers, but the disk I/O
requires an unacceptable amount of activity. (With more than 4 million
write functions needed between shp, shx & dbf... I'm concerned about
affecting the life and integrity of my hard drive).

I could use ArcView, but that would be a manual process with more than
300 layers to process. Is there any ArcView script running around there
that could do this? Otherwise, are there any shpcreate, dbfcreate,
shpadd, dbfadd executables that would take a file name as an argument
and write the data in one pass? I want to get to one open/write/close
activity for each layer rather than for each point.

Thanks much for any assistance.
Kieran







More information about the MapServer-users mailing list