[Freegis-list] ogr2ogr: csv to shpefile (newby question)

Mateusz Łoskot mateusz at loskot.net
Thu Dec 29 11:50:19 CET 2005


Tomas Zajc wrote:
> Is there any other (command line) application that can convert csv to
>  shapefiles? gen2shp only convert generate files that  can't contain 
> attributes.

Do you know some scripting language i.e. Python?
If you do, then it should not take much time to write a script
to convert your CSV to Shapefile.

Download pyshapelib, a Python wrapper for
Shapelib (http://shapelib.maptools.org):

http://hobu.biz/software/pyshapelib

Read your CSV file and split every line (record) using comma
delimiter. Then write coordinates (data from column you where have 
lat/lon) as Shape object, but other data to DBF - in fields of record 
for Shape object created formerly.

Writing scripts is a very nice fun :-)

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net




More information about the Freegis-list mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)