Comments (10)
Turns out doing schema=ds.schema.copy()
doesn't work on some Shapefiles either. I processes two Shapefiles. One preserved the properties and schema while the other did not.
from fiona.
Here are links to the two troublesome Shapefile(s) in question:
from fiona.
What Fiona version are you using? I'm unable to reproduce the problem (using the head of the Fiona repo, 1.2.18 to-be):
>>> with fiona.open('/', vfs='zip:///Users/seang/Downloads/STE11aAust.zip', layer=u'STE11aAust') as c:
... with fiona.open('/tmp/foo.shp', 'w', **c.meta) as d:
... d.write(next(c))
...
>>>
The output:
krusty-2:~ seang$ ogrinfo -so /tmp/foo.shp foo
INFO: Open of `/tmp/foo.shp'
using driver `ESRI Shapefile' successful.
Layer name: foo
Geometry: 3D Polygon
Feature Count: 1
Extent: (140.999475, -37.505060) - (159.109219, -28.157020)
Layer SRS WKT:
GEOGCS["GRS 1980(IUGG, 1980)",
DATUM["unknown",
SPHEROID["GRS80",6378137,298.257222101]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
STATE_CODE: String (1.0)
STATE_NAME: String (50.0)
Would appreciate if you could provide the smallest possible script that produces the problem.
from fiona.
So doing the same thing with the other Shapefile IBRA7.zip
:
>>> import fiona
>>> with fiona.open("/", vfs="zip:///Users/s2092651/ccaih/ccav/data/.sources/regions/IBRA7.zip", layer=u"IBRA7_regions") as c:
... with fiona.open("/tmp/foo.shp", "w", **c.meta) as d:
... d.write(next(c))
...
>>>
And the output of:
$ ogrinfo -so /tmp/foo.shp foo
INFO: Open of `/tmp/foo.shp'
using driver `ESRI Shapefile' successful.
Layer name: foo
Geometry: Polygon
Feature Count: 1
Extent: (132.612732, -14.365490) - (136.984990, -10.903420)
Layer SRS WKT:
GEOGCS["GRS 1980(IUGG, 1980)",
DATUM["unknown",
SPHEROID["GRS80",6378137,298.257222101]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
FID: Real (11.0)
from fiona.
Sorry, once again I can't reproduce the problem (GDAL 1.9.2 here). What's your GDAL version?
>>> with fiona.open('/', vfs='zip:///Users/seang/Downloads/IBRA7.zip', layer=u'IBRA7_regions') as c:
... with fiona.open('/tmp/foo.shp', 'w', **c.meta) as d:
... d.write(next(c))
...
>>>
Results:
(toblerity27)krusty-2:shapely seang$ dumpgj -d /tmp/foo.shp
{"crs": {"ellps": "GRS80", "no_defs": true, "proj": "longlat"}, "driver": "ESRI Shapefile", "name": "/tmp/foo.shp", "schema": {"geometry": "Polygon", "properties": {"AREA": "float:19.8", "FEAT_ID": "str:50", "HECTARES": "float:19.8", "OBJECTID": "int:10", "REC_ID": "int:10", "REG_CODE_6": "str:9", "REG_CODE_7": "str:6", "REG_NAME_6": "str:50", "REG_NAME_7": "str:100", "REG_NO_61": "float:19.8", "SHAPE_AREA": "float:19.11", "SHAPE_LEN": "float:19.11", "SQ_KM": "float:19.8"}}}
(toblerity27)krusty-2:shapely seang$ ogrinfo -so /tmp/foo.shp foo
INFO: Open of `/tmp/foo.shp'
using driver `ESRI Shapefile' successful.
Layer name: foo
Geometry: 3D Polygon
Feature Count: 1
Extent: (132.612732, -14.365490) - (136.984990, -10.903420)
Layer SRS WKT:
GEOGCS["GRS 1980(IUGG, 1980)",
DATUM["unknown",
SPHEROID["GRS80",6378137,298.257222101]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
SHAPE_AREA: Real (19.11)
REG_NAME_7: String (100.0)
REG_NAME_6: String (50.0)
OBJECTID: Integer (10.0)
AREA: Real (19.8)
FEAT_ID: String (50.0)
REC_ID: Integer (10.0)
REG_NO_61: Real (19.8)
SHAPE_LEN: Real (19.11)
HECTARES: Real (19.8)
SQ_KM: Real (19.8)
REG_CODE_7: String (6.0)
REG_CODE_6: String (9.0)
from fiona.
That's really odd. I have GDAL 1.10.0 here.
Let me do some more digging on my end... In the meantime I've used the
ogr2ogr
tool with the -simplify
option.
cheers
James
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
On Tue, Jul 23, 2013 at 12:38 PM, Sean Gillies [email protected]:
Sorry, once again I can't reproduce the problem (GDAL 1.9.2 here). What's
your GDAL version?with fiona.open('/', vfs='zip:///Users/seang/Downloads/IBRA7.zip', layer=u'IBRA7_regions') as c:
... with fiona.open('/tmp/foo.shp', 'w', **c.meta) as d:
... d.write(next(c))
...Results:
(toblerity27)krusty-2:shapely seang$ dumpgj -d /tmp/foo.shp
{"crs": {"ellps": "GRS80", "no_defs": true, "proj": "longlat"}, "driver": "ESRI Shapefile", "name": "/tmp/foo.shp", "schema": {"geometry": "Polygon", "properties": {"AREA": "float:19.8", "FEAT_ID": "str:50", "HECTARES": "float:19.8", "OBJECTID": "int:10", "REC_ID": "int:10", "REG_CODE_6": "str:9", "REG_CODE_7": "str:6", "REG_NAME_6": "str:50", "REG_NAME_7": "str:100", "REG_NO_61": "float:19.8", "SHAPE_AREA": "float:19.11", "SHAPE_LEN": "float:19.11", "SQ_KM": "float:19.8"}}}(toblerity27)krusty-2:shapely seang$ ogrinfo -so /tmp/foo.shp foo
INFO: Open of/tmp/foo.shp' using driver
ESRI Shapefile' successful.Layer name: foo
Geometry: 3D Polygon
Feature Count: 1
Extent: (132.612732, -14.365490) - (136.984990, -10.903420)
Layer SRS WKT:
GEOGCS["GRS 1980(IUGG, 1980)",
DATUM["unknown",
SPHEROID["GRS80",6378137,298.257222101]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
SHAPE_AREA: Real (19.11)
REG_NAME_7: String (100.0)
REG_NAME_6: String (50.0)
OBJECTID: Integer (10.0)
AREA: Real (19.8)
FEAT_ID: String (50.0)
REC_ID: Integer (10.0)
REG_NO_61: Real (19.8)
SHAPE_LEN: Real (19.11)
HECTARES: Real (19.8)
SQ_KM: Real (19.8)
REG_CODE_7: String (6.0)
REG_CODE_6: String (9.0)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-21389881
.
from fiona.
The thought of GDAL 1.10 breaking Fiona is a bit terrifying. I'll have to look into this ASAP.
from fiona.
If you like I can find some time today or tomorrow morning to downgrade and
re-test.
I actually did not realize I was using GDAL 1.10.
cheers
James
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
On Wed, Jul 24, 2013 at 1:40 PM, Sean Gillies [email protected]:
The thought of GDAL 1.10 breaking Fiona is a bit terrifying. I'll have to
look into this ASAP.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-21461783
.
from fiona.
I can't reproduce your problem with GDAL 1.10 either. I'm sorry, but will close this.
from fiona.
No problems. Thanks for trying!
James Mills / prologic
E: [email protected]
W: prologic.shortcircuit.net.au
On Tue, Jul 30, 2013 at 2:51 PM, Sean Gillies [email protected]:
I can't reproduce your problem with GDAL 1.10 either. I'm sorry, but will
close this.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/53#issuecomment-21769571
.
from fiona.
Related Issues (20)
- Drop support for Python 3.7 and 3.8 HOT 5
- Support for PMTile?
- Remove dependency on Numpy for VSI read buffer HOT 1
- Bring back Python 3.8 for 1.10
- A new OGRGeometryH based Geometry class
- 1.9.6 release HOT 1
- Rename master branch to main
- Add name keyword argument to fiona.open() and Collection constructor HOT 2
- Address high priority items on OpenSSF scorecard report
- 1.9.6: build fails with `-Wincompatible-pointer-types` HOT 8
- Change python opener VSI plugin prefix to /vsifiopener
- 1.9.6: pytest fails in 47 units HOT 3
- 1.10 Windows wheels?
- Fiona no longer recognizes pd.Timestamp (as datetime.datetime) since 1.10 a2 HOT 3
- Make features printable again HOT 2
- Error when importing fiona on an M1 Mac. HOT 12
- Pip package fiona-1.9.6.tar.gz has inconsistent version: filename has '1.9.6', but metadata has '0.0.0' HOT 3
- RFE: use `zoneinfo` instead of `pytz` HOT 2
- Field Name encode error when writing to Mapinfo File HOT 7
- Solve various Python opener issues as in rasterio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fiona.