[Gdal-dev] using ogr2ogr to create pt shp file from dbf w/ lat-lon fields

Emilio Mayorga emiliomayorga at gmail.com
Wed Mar 22 01:04:52 EST 2006


I have a polygon shape file that has lat & lon fields for the centroid
(the polygons are simple rectangles). I'd like to write a simple batch
process to read those lat-lon fields and create a point shape file
that also includes all the other attributes. I'd like to keep this as
simple as possible, so I figured I could use ogr2ogr.

It sounds like I need to set up a Virtual Spatial Data file. The
"Virtual Spatial Data (ODBC/OVF)" MapServer document says that I could
use an ODBC connection after setting up a DSN. I have unixODBC
installed on a RedHat server, but I don't see a dbf/dbase driver, and
I can't find one either in the unixODBC home page.

Alternatively, I could try to export the dbf to a text file (say,
csv), using something like the dbflist utility (part of the dbf2info
utilities; I've never used them, but I assume I can set them up!). The
MapServer document seems to imply that I could then set up an OVF to
link directly to flat text files without an ODBC DSN, but I can't find
any examples; I only see ODBC examples.

Any advice on what's the easiest approach to accomplish this? Thanks!

-Emilio Mayorga




More information about the Gdal-dev mailing list