Tag Info

Hot answers tagged


This is a GDAL/OGR Python gotcha. So when you use print inputlyr[0].GetGeometryRef(), the reference to the indexed feature has been cleaned up before geometry functions can be used. This is expected behaviour, and there is no roadmap to change it. The issue is that the GDAL/OGR Python bindings are over a decade old, and are tightly coupled with the ...


Numbers in any programming language does not have "absolute" precision. As they must be represented as bits in the computer hardware its precision is limited. Anyway review this links, because maybe they can help you: http://comments.gmane.org/gmane.comp.gis.gdal.devel/19331 http://lists.osgeo.org/pipermail/gdal-dev/2011-August/029793.html


Don't expect OGR to be Pythonic. In fact, there is a large list of gotchas documented to describe these. Essentially, all of the variables are references to objects described in C++, so they often don't make sense with workflows in Python. Modules like copy only work on Python objects, which is why your example doesn't work as expected. You need to keep ...


Maybe try something like this? http://docs.geotools.org/stable/userguide/library/jts/geometry.html#creating-circularstring


Not really a answer but a valid workaround: because the CreateLayer() method accept a SRS as parameter, one can create a new empty layer with the correct SRS and then fill it with the features from the input layer: import ogr driver = ogr.Open(input_file).GetDriver() datasource = driver.Open(input_file, 0) input_layer = datasource.GetLayer() dest_srs = ...


In your solution you mix geometries and predicates of ogr and Shapely With Shapely only (intersection(), intersects()) from shapely.geometry import Point, LineString, mapping geom1 = LineString([(0, 0), (0, 1)]) geom2 = LineString([(1, 1), (-1,-1)]) intersection = geom1.intersection(geom2) # geo_interface -> GeoJSON mapping(intersection) {'type': ...


Your 'ENGL_NAME' shouldn't be abbreviated at all (less than 10 characters), but writeOGR has its own will, it seems. Instead of writeOGR(shp, "PolygonsV2", speciesname, driver="ESRI Shapefile") you might try currdir <- getwd() #store your current working directory setwd(paste(currdir,"PolygonsV2",sep="/")) #switch to your desired folder ...

Only top voted, non community-wiki answers of a minimum length are eligible