I would like to be able to convert Lat long values in wgs84 to the swedish RT90, the values are in CSV files under headings X and Y. I would like to have this portable, an eg runned in a script in python idle or something similar. I have a python script today on USB that uses the pyshp module to convert csv files to shapefiles, but some of the csv are in wgs84 which would be nice to have converted in the same process.

Can gdal be used, and can it be made portable?


This post from the FWTools mailing list suggests that a barebones OSGeo4W installation is portable at least for the command line utilities, presumably including ogr2ogr.

You might also be interested in Portable GIS v3.

  • Your link to the post is interesting, however I need to study to see how to do and if that makes it possible to what I like to do. It would be great if it end with an import in my python script that can make use of a library or module. Yes - I am already using the Portable GIS v3. However I'd like to run a script in python idle that can perform this conversion...:/ – user12402 Nov 1 '12 at 8:59

You could do a few things. You can write virtual datasources to give the csv some metadata, and use: ogr2ogr -t_srs -f "ESRI Shapefile" "+proj=tmerc +lat_0=0 +lon_0=15.80827777777778 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +units=m +no_defs" out.shp in.vrt

where the virtual datasource is defined similar to the one on the csv driver documentation page: http://gdal.org/ogr/drv_csv.html

I you wanted to do it all in python, you can follow the tutorial for the ogr read/write stuff. The only thing you would have to do other than what's in the tutorial is reproject your points using an OGRCoordinateTransformation. See both tutorials (go to the bottom for the write tutorial for the api, it is very similar to your case):



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.