New answers tagged

4

I got an orders of magnitude speed-up simply by moving two if statements just underneath their corresponding fiona.listlayers calls. if (featureName == "HydrographySrf") if (bldgName == "StructureSrf") I just went from taking over 5.5 hours of parsing down to less than 2.5 minutes. Sorry for getting things spun up on what is otherwise an easy fix.


1

It could be that your GDB files (which are self-contained databases) have indexes designed to make these kinds of operations very fast for ArcGIS. If OGR (which is what Fiona uses to read GDB files) supports these indexes, you should be able to get a significant speed up if not the same performance as ArcGIS. The section at ...


2

If fiona.open(gdb_path) doesn't raise an exception, you've got an open dataset. You can print out its metadata for more verification. with fiona.open(gdb_path) as src: print(src.meta) Shapely is a computational geometry library: buffers, intersections, &c. It doesn't do spatial joins but can be used to help your own join implementations.


1

If you're working with spatial data and Pandas you should take a look at GeoPandas. The example below demonstrates how to perform a spatial join in GeoPandas (which uses Shapely). A GeoDataFrame object is created from a list of cities and their coordinates and is joined to an ESRI Shapefile containing countries. import pandas import geopandas import ...


1

To effectively use shapely it is important to first project your coordinates into a projected coordinate system that is appropriate to your region, for example, epsg:27700 if you are based in the UK. A good way to do this is using pyproj: import pyproj as proj # setup your projections crs_wgs = proj.Proj(init='epsg:4326') # assuming you're using WGS84 ...


2

You mix two thinks, Shapely and the GeoJSON format. By definition, Shapely process geometric objects and does not deal with attributes from shapely.geometry import GeometryCollection, mapping s = GeometryCollection() # GeoJSON format geo = mapping(s) print geo {'type': 'GeometryCollection', 'geometries': []} Now if you want to add attributes, you can ...



Top 50 recent answers are included