ogr does not recognize the .kml file unzipped from the .kmz file :o(
$unzip infile.kmz
Archive: infile.kmz
inflating: doc.kml
$ ogrinfo doc.kml
FAILURE:
Unable to open datasource `gocek_revised_20090604_AC.kml' with the following drivers.
...
-> KML
...
so I use gpsbabel to convert the .kml file into gpx format :
gpsbabel -i kml -f doc.kml -o gpx -F doc.gpx
I then load the gpx file into Quantum GIS using the GPS plugin. Then I output the loaded layer into shapefile.
I am sure smarter ways to achieve this exist but that's what I could come up with this fast using OpenSource tools.
vive l'OpenSource!
Nothing fancy. Just a scratchboard for Open Source Geospatial manipulations. Involves (although not limited to) Linux, R, gdal, Quantum GIS, Geoserver etc.
Showing posts with label ogr. Show all posts
Showing posts with label ogr. Show all posts
Thursday, June 4, 2009
Sunday, February 22, 2009
Changing the projection of a spatial data using ogr2ogr and gdalwarp
Changing the projection of a shapefile using ogr2ogr :
Download and install ogr/gdal (yes, it's free).
To create output.shp with the WGS84 (4326) projection, use the following syntax :
ogr2ogr output.shp -t_srs "EPSG:4326" input.shp
To simply extract Features 1,2,3 and export into GML :
ogr2ogr output.gml input.tab -f "GML" -where "fid in (1,2,3)"
Similarly, use gdalwarp for raster data :
gdalwarp -t_srs 'EPSG:4326' input.tif output.tif
voilĂ
Download and install ogr/gdal (yes, it's free).
To create output.shp with the WGS84 (4326) projection, use the following syntax :
ogr2ogr output.shp -t_srs "EPSG:4326" input.shp
To simply extract Features 1,2,3 and export into GML :
ogr2ogr output.gml input.tab -f "GML" -where "fid in (1,2,3)"
Similarly, use gdalwarp for raster data :
gdalwarp -t_srs 'EPSG:4326' input.tif output.tif
voilĂ
Subscribe to:
Posts (Atom)