toblerity / fiona Goto Github PK
View Code? Open in Web Editor NEWFiona reads and writes geographic data files
Home Page: https://fiona.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Fiona reads and writes geographic data files
Home Page: https://fiona.readthedocs.io/
License: BSD 3-Clause "New" or "Revised" License
Currently, Fiona supports read ("r"), write ("w"), and append ("a") modes in the same manner as Python's file object does. How important is "r+" access to you? If we were to add it, it would probably be done in the Python file manner again:
with collection("/path/to/data.shp", "r+") as c:
c.seek_feature(10)
c.write({...})
Unsorted arguments against:
A lot of OGR format drivers don't support random access anyway and have to fake it. I haven't been able to find a breakdown of which do and which don't. When they do have to fake it, it seems like any benefits of "r+" access are lost.
The cythonize function needs more information about names of extension modules.
A great feature would be to define or read the width of numeric fields.
For example, specify an integer field in a dbf to be 10 digits wide or a double or float field to be a width of 12 digits and 6 decimals.
Thanks!
Dennis
Support for reading from KML.
I note that KML is explicitly commented out as one of the supported import formats (https://github.com/Toblerity/Fiona/blob/master/src/fiona/__init__.py#L173). Could support be added just by allowing this?
Feel free to close as a wontfix but I'd be interested to understand why KML is not supported (and what are your recommended alternatives for converting e.g. KML => GeoJSON).
Shapefiles have no type MultiPolygon
, but they support them anyway (all rings are stored in one polygon). See: http://www.gdal.org/ogr/drv_shapefile.html
Fiona/OGR handles everything right when I create a new Shapefile with geometry type MultiPolygon
, but when I open it for appending the type changes to Polygon
. Fiona will then refuse to write additional MultiPolygons (see WritingSession.writerecs
).
How should we handle that? Ignore the Multi
prefix when checking the geometry type for 'ESRI Shapefile' drivers?
playing with some osm extracts.
converted shapefile to geojson
ogr2ogr -f GeoJSON paris-lines.json paris.osm-line.shp
copied to: http://dump.twofishes.net/paris-lines.json
blackmad@ns4005169:~/sites/the-neighborhoods-project$ ./make-holes.py ~/osm/paris-lines.json
Traceback (most recent call last):
File "./make-holes.py", line 12, in
source = fiona.open(sys.argv[1], 'r')
File "/usr/local/lib/python2.7/dist-packages/Fiona-0.12.1-py2.7-linux-x86_64.egg/fiona/init.py", line 99, in open
c = Collection(path, mode, encoding=encoding)
File "/usr/local/lib/python2.7/dist-packages/Fiona-0.12.1-py2.7-linux-x86_64.egg/fiona/collection.py", line 92, in init
self.session.start(self)
File "ogrext.pyx", line 591, in fiona.ogrext.Session.start (src/fiona/ogrext.c:9701)
ValueError: Null layer
weirdly I'm hitting the same issue with geojson I'm constructing by hand that qgis is happy to render: http://dump.twofishes.net/paris.osm-roads.shp.json
Fiona Version: 1.0.2
Python Version: 2.7.3
Is it possible to write GeoJSON records having a non-EPSG 4326 CRS?
This is the metadata of the collection I am writing:
fiona_object.meta
{'crs': {'a': 6370997, 'lon_0': -100, 'y_0': 0, 'no_defs': True, 'proj': 'laea', 'x_0': 0, 'units': 'm', 'b': 6370997, 'lat_0': 45},
'driver': 'GeoJSON',
'schema': {'geometry': 'MultiPolygon', 'properties': OrderedDict([('DID', 'int'), ('VID', 'int'), ('UGID', 'int'), ('TID', 'int'), ('LID', 'int'), ('GID', 'int'), ('VARIABLE', 'str'), ('ALIAS', 'str'), ('TIME', 'datetime'), ('YEAR', 'int'), ('MONTH', 'int'), ('DAY', 'int'), ('LEVEL', 'int'), ('VALUE', 'float')])}}
After closing a reopening the collection, the metadata is:
{'crs': {u'no_defs': True, u'datum': u'WGS84', u'proj': u'longlat'},
'driver': u'GeoJSON',
'schema': {'geometry': 'MultiPolygon', 'properties': OrderedDict([(u'DID', 'int'), (u'VID', 'int'), (u'UGID', 'int'), (u'TID', 'int'), (u'LID', 'int'), (u'GID', 'int'), (u'VARIABLE', 'str'), (u'ALIAS', 'str'), (u'TIME', 'str'), (u'YEAR', 'int'), (u'MONTH', 'int'), (u'DAY', 'int'), (u'LEVEL', 'int'), (u'VALUE', 'float')])}}
Thanks!
offending file: http://cl.ly/1F2f2X1J073E
coll = collection('rus_adm0.shp', 'r')
[f['geometry'] for f in coll]
Traceback (most recent call last):
File "", line 1, in
File "ogrext.pyx", line 848, in fiona.ogrext.Iterator.next (src/fiona/ogrext.c:14008)
File "ogrext.pyx", line 446, in fiona.ogrext.FeatureBuilder.build (src/fiona/ogrext.c:7923)
ValueError: Null geometry
Fiona's field types have names that correspond to Python types. OGR's OFTInteger becomes 'int'; OFTString, 'str'. I propose that the list types be named liked this:
OFTIntegerList: 'list:int'
OFTRealList: 'list:float'
OFTStringList: 'list:str'
Traceback (most recent call last):
File "test_fiona.py", line 5, in
for f in source:
File "ogrext.pyx", line 667, in fiona.ogrext.Iterator.next (src/fiona/ogrext.c:10212)
File "ogrext.pyx", line 383, in fiona.ogrext.FeatureBuilder.build (src/fiona/ogrext.c:6503)
File "ogrext.pyx", line 173, in fiona.ogrext.GeomBuilder.build (src/fiona/ogrext.c:3263)
IndexError: list index out of range
Traceback (most recent call last):
File "test_fiona.py", line 5, in
for f in source:
File "ogrext.pyx", line 667, in fiona.ogrext.Iterator.next (src/fiona/ogrext.c:10212)
File "ogrext.pyx", line 367, in fiona.ogrext.FeatureBuilder.build (src/fiona/ogrext.c:6325)
ValueError: Invalid field type 9
Where we expect '+init=epsg:4326 +no_defs', we get
>>> from fiona import crs
>>> crs.to_string(crs.from_epsg(4326))
'+no_defs'
Reported by @kjordahl.
pip install Fiona gave me:
fatal error: 'cpl_error.h' file not found
This was because gdal was not installed (fixed with homebrew brew install gdal
)
You might want to add this solution to the documentation. It already says you need gdal, but knowing how to install it could help people.
Thanks!
I've noticed in code (even in fiona-0.16) that I have to re-open the Shapefile every time I call the filter
function. Is this by design or a bug or something out of fiona's control wrt OGR?
From https://gist.github.com/sgillies/5937555. Returns the proper Python type for a schema property.
I've found the following code does not work:
#!/usr/bin/env python
"""Tool to simplify geometries in a vector file"""
import sys
import fiona
from shapely import speedups
from shapely.geometry import mapping, shape
speedups.available and speedups.enable()
def main():
if len(sys.argv) < 3:
print "Usage: fixgeometries <infile>"
raise SystemExit(1)
with fiona.open(sys.argv[1], "r") as ds:
items = ((feature, shape(feature["geometry"])) for feature in ds)
with fiona.open(sys.argv[2], "w", **ds.meta) as sink:
for feature, geometry in items:
id = feature.get("properties", {}).get("OBJECTID", None) or feature.get("id", None)
if not geometry.is_valid:
print "Geometry of Feature id {0:s} is not valid. Fixing...".format(str(id))
geometry = geometry.buffer(0.0)
geometry = geometry.simplify(0.01)
if not geometry.is_valid:
geometry = geometry.buffer(0.0)
feature["geometry"] = mapping(geometry)
sink.write(feature)
if __name__ == "__main__":
main()
The resulting output ESRI Shapefile does not
contain any of the original properties nor does the
output schema match the original.
The only way I've found that does work is to
do something like:
with fiona.open(..., "w", crs=ds.crs, driver=ds.driver, schema=ds.schema.copy()) as sink:
Is this something that can be fixed in Fiona?
Documentation tends to lead me to believe that one could and should use **ds.meta
as a nice convenient way to use the input source's schema when you're doing things like cleaning up geometries in a Shapefile, etc...
Tag and upload 0.11 to PyPI.
I swear I've installed Fiona fine before, but on this Mac OS 10.6 with Python 2.7 box it's giving me the following error. Suggestion?
Aside: Shapely installs and imports just fine (from src).
import fiona
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/fiona/init.py", line 69, in
from fiona.collection import Collection, supported_drivers
File "/usr/local/lib/python2.7/site-packages/fiona/collection.py", line 6, in
from fiona.ogrext import Iterator, Session, WritingSession
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/fiona/ogrext.so, 2): no suitable image found. Did find:
/usr/local/lib/python2.7/site-packages/fiona/ogrext.so: mach-o, but wrong architecture
from fiona import collection
collection('chl_adm0.shp', 'r').schema
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/fiona/collection.py", line 84, in schema
self._schema = self.session.get_schema()
File "ogrext.pyx", line 616, in fiona.ogrext.Session.get_schema (src/fiona/ogrext.c:10549)
IndexError: list index out of range
the offending file:
http://cl.ly/1F0b0J2A171m
works fine for other shapefiles:
collection('bra_adm0.shp', 'r').schema
{'geometry': 'Polygon', 'properties': {u'qs_adm0': 'str', u'qs_a1': 'str:254', u'qs_a2': 'str:254', u'qs_adm0_a3': 'str', u'qs_a2_lc': 'int', u'qs_level': 'str', u'qs_a1_lc': 'str:254'}}
See http://www.gdal.org/ogr/drv_shapefile.html:
Note that when reading a Shapefile of type SHPT_ARC, the corresponding layer will be reported as of type
wkbLineString, but depending on the number of parts of each geometry, the actual type of the geometry for each
feature can be either OGRLineString or OGRMultiLineString. The same applies for SHPT_POLYGON shapefiles,
reported as layers of type wkbPolygon, but depending on the number of parts of each geometry, the actual type
can be either OGRPolygon or OGRMultiPolygon.
When reading from a "polygon" type shapefile, you might get polygons or multi-polygon features. TBD: whether to coerce geometries or just relax the single-type constraint in Fiona for just the Shapefile format.
Reported by @thesteve0.
Windows, Python 2.7, ..?
ImportError: cannot import name string_types
Traceback (most recent call last):
File "E:\p\pythonlib\learn\gdaltest.py", line 9, in
import fiona
File "..\lib\fiona__init__.py", line 69, in
from six import string_types
ImportError: cannot import name string_types
In #45 I wrote about adding the ability to select a single layer from a directory or multi-layer file. Users will now need a method to get a listing of available layers. I propose this:
>>> import fiona
>>> fiona.listdir('docs/data/test_uk.shp')
['test_uk']
It would be to os.listdir what fiona.open is to io.open. Good? Bad? I like listdir as a name but would be open to listlayers instead.
it seems like unicode strings aren't being correctly written out -- I see all ????? for the name in this shapefile in both dbfdump and qgis (looking at the hex of the dbf, they are definitely all question marks, it's not a read encoding issue)..
Is this related to http://lists.osgeo.org/pipermail/gdal-dev/2012-April/032393.html + http://trac.osgeo.org/gdal/wiki/rfc5_unicode ?
Is there any way to work around this?
code:
from shapely.geometry import Point, mapping
from fiona import collection
schema = { 'geometry': 'Point', 'properties': { 'name': 'str' } }
with collection(
"some.shp", "w", "ESRI Shapefile", schema, encoding='utf-8') as output:
point = Point(40.74, -74.0)
output.write({
'properties': {
'name': u'Москва'
},
'geometry': mapping(point)
})
qgis:
http://www.whizziwig.com/static/captured/kaLDA.png
[blackmad@wfmu tmp]$ dbfdump /tmp/some.dbf
name
??????
[blackmad@wfmu tmp]$ hexdump -C /tmp/some.dbf
00000000 03 5f 07 1a 01 00 00 00 41 00 51 00 00 00 00 00 |._......A.Q.....|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 00 |.............W..|
00000020 6e 61 6d 65 00 00 00 00 00 00 00 43 00 00 00 00 |name.......C....|
00000030 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |P...............|
00000040 0d 20 3f 3f 3f 3f 3f 3f 20 20 20 20 20 20 20 20 |. ?????? |
Unless I am missing something (dug though the code, issues, mailing lists) fiona doesn't seem to support writing null geometries. It does however support reading null geometries and returns {"geometry": None}
as you'd expect. Trying to do this the other way fails.
I had trouble installing Fiona on Mac OSX 10.6.8. Errors were like this:
Traceback (most recent call last):
File "io.py", line 2, in <module>
import fiona
File "/Library/Python/2.6/site-packages/fiona/__init__.py", line 71, in <module>
from fiona.collection import Collection, supported_drivers, vsi_path
File "/Library/Python/2.6/site-packages/fiona/collection.py", line 7, in <module>
from fiona.ogrext import Iterator, Session, WritingSession
ImportError: dlopen(/Library/Python/2.6/site-packages/fiona/ogrext.so, 2):
Symbol not found: _CPLSetThreadLocalConfigOption
Referenced from: /Library/Python/2.6/site-packages/fiona/ogrext.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/fiona/ogrext.so
I had GDAL 1.9.2 installed via KyngChaos. GDAL Python bindings are ok, also for other progs. I tried installing Fiona in several ways: via pip, from GIT via setup.py. Always the same runtime error.
Basically the GDAL dyn library is not found at runtime. I saw a suggestion http://sgillies.net/blog/1175/fiona-0-12 to set DYLD_LIBRARY_PATH, but whatever variant I tried: always the same error on the first "import fiona". btw DYLD_LIBRARY_PATH should be a colon-separated series of dirs, not a library itself.
otool, nm, and file commands told me that the symbols were defined and both ogrext.so and GDAL dynlib were multi-arch.
Spent several hours, looking if my system was somehow contaminated with old GDAL versions etc. Found some in /usr/local/lib, removed them, restarted but still the error (probably I should reload. Finally I found in the Mac OSX Manual other ways of enforcing a specific dyn library using
export DYLD_INSERT_LIBRARIES=/Library/Frameworks/GDAL.framework/Versions/Current/GDAL
(GDAL is the dynlib itself on Mac OSX, not a directory) it worked!
Fiona is a great toolkit, I see several uses. Installing on Ubuntu Linux was a breeze. If others don't have similar problems on Mac OSX then it must be my unique config assembled over the last few years....
Tag and upload the 1.0 release to PyPI.
fiona.odict is missing in the 1.0.1 release and the git master branch.
When I run this script ...
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fiona
path1 = "test_data/english/test_uk.shp"
path2 = "test_data/español/test_uk.shp"
with fiona.open(path1, 'r') as source:
print source.bounds
with fiona.open(path2, 'r') as source:
print source.bounds
.. I get this output:
(-8.621389, 49.911659, 1.749444, 60.844444)
Traceback (most recent call last):
File "fionaFail.py", line 12, in <module>
with fiona.open(path2, 'r') as source:
File "/Users/bgolder/projects/aavs/lib/python2.7/site-packages/fiona/__init__.py", line 123, in open
encoding=encoding, layer=layer, vsi=vsi, archive=archive)
File "/Users/bgolder/projects/aavs/lib/python2.7/site-packages/fiona/collection.py", line 113, in __init__
self.session.start(self)
File "ogrext.pyx", line 588, in fiona.ogrext.Session.start (src/fiona/ogrext.c:9975)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 15: ordinal not in range(128)
If I designate encoding, it doesn't seem to help.
In a fresh checkout of the source code, several files required to run tests do not exist. The files test_uk.zip
, test_uk.tar
and test_uk.json
are missing, and there doesn't seem to be a standard way to create them. I created them from the included files in the docs/data
directory, with some trial and error. I'm still failing one test that depends on test_uk.tar
, and it's not immediately obvious whether it is because I've created that file incorrectly or for some other reason.
Should these files either be explicitly included or created easily from the included test data?
I can't seem to build Fiona from source (this repo) despite having Cuthon installed and in the path.
[webapps@ccav ~]$ workon dev
(dev)[webapps@ccav ~]$ cd
(dev)[webapps@ccav ~]$ cd work/Fiona/
(dev)[webapps@ccav Fiona]$ python setup.py develop
running develop
running egg_info
writing requirements to src/Fiona.egg-info/requires.txt
writing src/Fiona.egg-info/PKG-INFO
writing top-level names to src/Fiona.egg-info/top_level.txt
writing dependency_links to src/Fiona.egg-info/dependency_links.txt
reading manifest file 'src/Fiona.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.zip' found under directory 'docs/data'
warning: no previously-included files matching '*.tar' found under directory 'docs/data'
warning: no previously-included files matching '*.json' found under directory 'docs/data'
warning: no previously-included files matching '*' found under directory 'docs/data/testing'
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no files found matching '*.txt' under directory 'tests'
writing manifest file 'src/Fiona.egg-info/SOURCES.txt'
running build_ext
building 'fiona.ogrinit' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/local/include/python2.7 -c src/fiona/ogrinit.c -o build/temp.linux-x86_64-2.7/src/fiona/ogrinit.o
gcc: src/fiona/ogrinit.c: No such file or directory
gcc: no input files
error: command 'gcc' failed with exit status 1
(dev)[webapps@ccav Fiona]$
Is it possible to apply a limiting SQL statement prior to iterating over a fiona Collection?
Presently, Fiona can only support single layer collections. It's difficult to understand from the OGR docs which drivers are always multilayer, which are always single-layer, and which can be both. The listing at the end of fiona/init.py is my attempt to enumerate the drivers that are or can be sources of single stand-alone layers. It's possible that there are some errors in there.
How will this list be used? When attempting to read data, we will assert that the driver chosen by OGR is in the list. When attempting to write data we will assert that the driver chosen by the programmer is in the list.
Dear potential Fiona users, how important are the multi-layer formats to you?
In writerecs, we need to skip geometry type validation in the GeoJSON driver case and let users write any kind of geometry.
Shapefiles default to 80 characters wide if not explicitly defined as wider. String column types have the ability to be set to 254 characters. Is there a way in Fiona to define the width of a column when writing to a shapefile?
I see the following line in the ograpi.pxd file:
void OGR_Fld_Set (void *fielddefn, char *name, int fieldtype, int width, int precision, int justification)
Yet I don't see it called anywhere else. I suspect that the width variable there allows for the definition of wider shapefile columns.
Package A's setup.py contains Fiona in "install_requires"
cd /path/to/A
python setup.py install
Fails with:
Searching for fiona
Reading http://pypi.python.org/simple/fiona/
Reading http://github.com/Toblerity/Fiona
Reading http://github.com/sgillies/fiona
Best match: Fiona 0.12
Downloading http://pypi.python.org/packages/source/F/Fiona/Fiona-0.12.tar.gz#md5=e91c0f9702366f49be50cb7cba4ec029
Processing Fiona-0.12.tar.gz
Running Fiona-0.12/setup.py -q bdist_egg --dist-dir /var/folders/zt/j6blp64j68b8bxffh7ynxwkm0000gq/T/easy_install-A20jd0/Fiona-0.12/egg-dist-tmp-6n2wlk
error: README.rst: No such file or directory
Currently when you try to write a shapefile using Fiona from the Python console in QGIS, you get a segmentation fault:
>>> c = fiona.open('foo.shp','w',driver='ESRI Shapefile',crs={},schema={'geometry':'LineString','properties':{}})
>>> cs = [(1.0,2.0),(45.0,32.0),(-10.2,39.1)]
>>> rec = {'geometry':{'type':'LineString','coordinates':cs},'properties':{}}
>>> c.write(cs)
Similar results occur when using Fiona within QGIS plugins. I know QGIS uses OGR internally, so perhaps there is not a way to get Fiona's OGR and QGIS's OGR to play nicely with each other, but I am not familiar enough with this sort of thing to know.
Here's the Apple backtrace from the QGIS crash:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.gdal.gdal 0x0000000118ccce14 OGRFeatureDefn::Release() + 54
1 ogrext.so 0x00000001187b59f8 __pyx_pw_5fiona_6ogrext_14WritingSession_3writerecs + 3208 (ogrext.c:9592)
2 org.python.python 0x000000011522f5a9 PyEval_EvalFrameEx + 9244
3 org.python.python 0x0000000115233869 0x115216000 + 120937
4 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
5 org.python.python 0x0000000115233869 0x115216000 + 120937
6 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
7 org.python.python 0x000000011522d147 PyEval_EvalCodeEx + 1934
8 org.python.python 0x000000011522fb3e PyEval_EvalFrameEx + 10673
9 org.python.python 0x000000011522d147 PyEval_EvalCodeEx + 1934
10 org.python.python 0x00000001152338df 0x115216000 + 121055
11 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
12 org.python.python 0x000000011522d147 PyEval_EvalCodeEx + 1934
13 org.python.python 0x00000001152338df 0x115216000 + 121055
14 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
15 org.python.python 0x0000000115233869 0x115216000 + 120937
16 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
17 org.python.python 0x0000000115233869 0x115216000 + 120937
18 org.python.python 0x000000011522f63a PyEval_EvalFrameEx + 9389
19 org.python.python 0x000000011522d147 PyEval_EvalCodeEx + 1934
20 org.python.python 0x0000000115266d7a 0x115216000 + 331130
21 org.python.python 0x00000001152256c6 PyObject_Call + 97
22 org.python.python 0x00000001152429bf 0x115216000 + 182719
23 org.python.python 0x00000001152256c6 PyObject_Call + 97
24 org.python.python 0x0000000115233018 PyEval_CallObjectWithKeywords + 177
25 sip.so 0x00000001154bc706 sip_api_call_method + 186
26 QtGui.so 0x000000011590fdb0 sipVH_QtGui_25(PyGILState_STATE, _object*, QKeyEvent*) + 64
27 QtGui.so 0x00000001159bc08d sipQTextEdit::keyPressEvent(QKeyEvent*) + 99
28 QtGui 0x0000000104d436cb QWidget::event(QEvent*) + 2491
29 QtGui 0x00000001050d623c QFrame::event(QEvent*) + 44
30 QtGui 0x000000010516365b QAbstractScrollArea::event(QEvent*) + 123
31 QtGui 0x000000010514e98b QTextEdit::event(QEvent*) + 91
32 QtGui.so 0x00000001159b919c sipQTextEdit::event(QEvent*) + 76
33 QtGui 0x0000000104ceb93d QApplicationPrivate::notify_helper(QObject*, QEvent*) + 189
34 QtGui 0x0000000104cf403b QApplication::notify(QObject*, QEvent*) + 9883
35 org.qgis.qgis_core 0x0000000103d84762 QgsApplication::notify(QObject*, QEvent*) + 100
36 QtCore 0x0000000104a3417c QCoreApplication::notifyInternal(QObject*, QEvent*) + 124
37 QtGui 0x0000000104cebb4c qt_sendSpontaneousEvent(QObject*, QEvent*) + 44
38 QtGui 0x0000000104d67fe1 QKeyMapper::sendKeyEvent(QWidget*, bool, QEvent::Type, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, int, unsigned int, unsigned int, unsigned int, bool*) + 225
39 QtGui 0x0000000104d68ea3 QKeyMapperPrivate::translateKeyEvent(QWidget*, OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*, bool) + 659
40 QtGui 0x0000000104c9dadf qt_dispatchKeyEvent(void*, QWidget*) + 223
41 QtGui 0x0000000104c8fe3f -[QCocoaView keyDown:] + 127
42 com.apple.AppKit 0x00007fff87491050 -[NSWindow sendEvent:] + 9687
43 QtGui 0x0000000104c94a37 -[QCocoaWindow sendEvent:] + 87
44 com.apple.AppKit 0x00007fff8748c674 -[NSApplication sendEvent:] + 5761
45 QtGui 0x0000000104c99b24 -[QNSApplication sendEvent:] + 84
46 com.apple.AppKit 0x00007fff873a224a -[NSApplication run] + 636
47 QtGui 0x0000000104ca4900 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 1824
48 QtCore 0x0000000104a33094 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 68
49 QtCore 0x0000000104a33444 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 324
50 QtCore 0x0000000104a35b2c QCoreApplication::exec() + 188
51 org.qgis.qgis 0x000000010000996b main + 10523
52 org.qgis.qgis 0x0000000100006c04 start + 52
$ shputils/dissolve-shapes.py -i che_adm0.shp -o che_adm0.shp -f qs_adm0_a3,qs_adm0,qs_level,qs_a0
Traceback (most recent call last):
File "shputils/dissolve-shapes.py", line 91, in
processInput()
File "shputils/dissolve-shapes.py", line 49, in processInput
matchingFields = [getActualProperty(input, f) for f in options.fields.split(',')]
File "/home/nate/public_html/dissolvers/shputils/merge_utils.py", line 28, in getActualProperty
originalSchema = collection.schema
File "/usr/local/lib/python2.6/dist-packages/fiona/collection.py", line 84, in schema
self._schema = self.session.get_schema()
File "ogrext.pyx", line 616, in fiona.ogrext.Session.get_schema (src/fiona/ogrext.c:10549)
IndexError: list index out of range
offending file: http://cl.ly/1F2f2X1J073E
coll = collection('rus_adm0.shp', 'r')
[f['geometry'] for f in coll]
Traceback (most recent call last):
File "", line 1, in
File "ogrext.pyx", line 848, in fiona.ogrext.Iterator.next (src/fiona/ogrext.c:14008)
File "ogrext.pyx", line 446, in fiona.ogrext.FeatureBuilder.build (src/fiona/ogrext.c:7923)
ValueError: Null geometry
Requested by a GIS Stack Exchange user.
HI I am on ubuntu and install fiona using pip install Fiona
. But when importing I get the following error
san@san-laptop:~$ ipython -c "import fiona"
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-cc872b235141> in <module>()
----> 1 import fiona
/usr/local/lib/python2.7/dist-packages/fiona/__init__.py in <module>()
69 from six import string_types
70
---> 71 from fiona.collection import Collection, supported_drivers, vsi_path
72 from fiona.odict import OrderedDict
73 from fiona.ogrext import _listlayers, FIELD_TYPES_MAP
/usr/local/lib/python2.7/dist-packages/fiona/collection.py in <module>()
5 import sys
6
----> 7 from fiona.ogrext import Iterator, Session, WritingSession
8 from fiona.errors import DriverError, SchemaError, CRSError
9 from six import string_types
ImportError: /usr/lib/libspatialite.so.3: undefined symbol: GEOSInterpolate
libgdal, libgdal-dev are installed using apt-get.
san@san-laptop:~$ uname -a
Linux san-laptop 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Thanks
This is an announcement that I'd like to ship Fiona 1.0 soon and a last call for feature requests. I've just added a dumpgj script which does a bit of both ogrinfo and ogr2ogr and serves as the canonical usage example. I'm going to tweak it a little more before 1.0, finalize some args and options, possibly add some JSON-LD context information, add CRS to the GeoJSON output.
Anything else?
Hi all, I'm looking for feedback on Fiona's support for virtual filesystems and multiple layers. Please see and comment on the examples at:
https://github.com/Toblerity/Fiona/blob/master/examples/io.py
Good? Bad?
Hi there! I read through the documents to see if there is a way to return an ordered list of the field names in a schema. Currently, the schema properties are returned as a dictionary, so the field names are returned out of order. An ordered list of fields is important when testing to see if a schema matches a specification (order, field widths, etc).
Thanks!
Dennis
Tag and upload.
It looks like VERSION.txt hasn't been updated since the 0.5 release, the current version number seems to be managed in src/fiona/init.py. Perhaps this file can either a) be removed or b) be automatically updated via the build process to sync with the correct version?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.