Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
related: Batch convert lat longs to UTM? –  blah238 Nov 1 '12 at 6:30
    
related: Running QGis from flash drive –  blah238 Nov 1 '12 at 6:52
    
related: Python for GIS on a thumb-drive –  blah238 Nov 1 '12 at 6:53
    
Do you need the output to be a shapefile, or csv? –  kyle Nov 30 '12 at 16:13

2 Answers 2

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.

share|improve this answer
    
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):

http://gdal.org/ogr/ogr_apitut.html

http://gdal.org/ogr/osr_tutorial.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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