Hot answers tagged ogr
6
As the name says, a SpatialPolygonsDataFrame is basically just a SpatialPolygons object with data attached (the attribute table).
The data must have at least as many rows as there are features
library(rgdal)
ob <- SpatialPolygons(..)# Your SpatialPolygons Object
spp <- ...
4
For a complete history of the evolution from EPSG:900913 to EPSG 3785 and finally EPSG:3857, look at AnĂ¡lisis de Google Maps (in Spanish) and the conclusions are:
The projection parameters defined for the EPSG: 900913 or 3785 describe a Mercator projection with geographic coordinates defined on a spherical model of the Earth, 6378.137m ratio, as specified ...
1
I followed the second approach now and this seems to work, comments welcome:
def sortlayer(l, fd):
# fids are unique, fids may be sorted or unsorted, fids may be consecutive or have gaps
# don't care about semantics, don't touch fids and their order, reuse fids
fids = []
vals = []
l.ResetReading()
for f in l:
fid = f.GetFID()
...
1
I'm afraid you have to accept the error message :-(
Shapefiles are intended to be point, line or polygon geometries, but not a mixture of them.
From http://www.gdal.org/ogr/drv_shapefile.html:
ESRI shapefiles can only store one kind of geometry per layer (shapefile).
There are other data formats (GML, GeoJSON, KML) which allow that, but you will be ...
1
One possible solution is to call ogr2ogr.
It is also possible to use OGR directly in Python but this is a little bit more difficult.
Here the solution if you call ogr2ogr as a subprocess:
import subprocess
# The features used to clip the input features.
clipping_shp = "US_States_STATE_NAME__Oregon.shp"
# The feature class to be created.
output_shp = ...
1
I think the problem here is simply one of competing definitions or at least names.
I'm told that WKT is fairly loose in some aspects (precision, order, names) and so you get vendor implementations that are technically the same coordinate system but with a slightly different definition.
In this case Esri's WKT for this coordinate system is slightly ...
Only top voted, non community-wiki answers of a minimum length are eligible