geometryIO

GDAL wrapper for reading and writing geospatial data to a variety of vector formats
Download

geometryIO Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Publisher Name:
  • Roy Hyunjin Han
  • Publisher web site:
  • https://github.com/invisibleroads/

geometryIO Tags


geometryIO Description

GDAL wrapper for reading and writing geospatial data to a variety of vector formats geometryIO is a GDAL wrapper for reading and writing geospatial data to a variety of vector formats. For a list of supported vector formats and driver names, please see http://www.gdal.org/ogr/ogr_formats.htmlInstallation:Here are instructions for installing geometryIO in a virtualenv# Prepare isolated environmentENV=$HOME/Projects/envvirtualenv --no-site-packages $ENV# Activate isolated environmentsource $ENV/bin/activate# Install GDALwget http://download.osgeo.org/gdal/gdal-1.8.0.tar.gztar xzvf gdal-1.8.0.tar.gzcd gdal-1.8.0./configure --prefix=$ENV --with-pythonmake install# Install packageexport LD_LIBRARY_PATH=$ENV/lib:$LD_LIBRARY_PATHeasy_install -U geometryIOUsage:Prepare environmentENV=$HOME/Projects/envsource $ENV/bin/activateexport LD_LIBRARY_PATH=$ENV/lib:$LD_LIBRARY_PATHipythonRun codeimport geometryIOimport itertoolsfrom osgeo import ogrfrom shapely import geometrygeometryIO.save( # Save to a compressed shapefile targetPath='polygons.shp.zip', # Declare that source coordinates are in longitude and latitude sourceProj4=geometryIO.proj4LL, # Specify geometries using shapely shapelyGeometries=), geometry.Polygon(), ], # Specify attributes for each geometry fieldPacks=, # Define attributes fieldDefinitions=, # Specify desired vector format driverName='ESRI Shapefile', # Transform coordinates to spherical mercator targetProj4=geometryIO.proj4SM)proj4, shapelyGeometries, fieldPacks, fieldDefinitions = geometryIO.load( # Load from a compressed shapefile sourcePath='polygons.shp.zip', # Transform coordinates to longitude and latitude targetProj4=geometryIO.proj4LL)for shapelyGeometry, fPack in itertools.izip(shapelyGeometries, fieldPacks): print for fValue, (fName, fType) in itertools.izip(fPack, fieldDefinitions): print '%s = %s' % (fName, fValue) print shapelyGeometrygeometryIO.save_points( # Save to a compressed shapefile targetPath='points.shp.tar.gz', # Declare that source coordinates are in longitude and latitude sourceProj4=geometryIO.proj4LL, # Specify coordinates coordinateTuples=)print geometryIO.load_points('points.shp.tar.gz') Requirements: · Python What's New in This Release: · Ported code from geometry_store


geometryIO Related Software