Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKT2 support #977

Closed
snowman2 opened this issue Nov 16, 2020 · 2 comments
Closed

WKT2 support #977

snowman2 opened this issue Nov 16, 2020 · 2 comments
Milestone

Comments

@snowman2
Copy link
Contributor

Related to:

Currently error is produced here:

import fiona
schema = {"geometry": "Point", "properties": {"zero": "int"}}
feature = {
    "geometry": {"type": "Point", "coordinates": (0, 0)},
    "properties": {"zero": "0"},
}
target_crs = 'PROJCS["IaRCS_04_Sioux_City-Iowa_Falls_NAD_1983_2011_LCC_US_Feet",GEOGCS["GCS_NAD_1983_2011",DATUM["D_NAD_1983_2011",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",14500000.0],PARAMETER["False_Northing",8600000.0],PARAMETER["Central_Meridian",-94.83333333333333],PARAMETER["Standard_Parallel_1",42.53333333333333],PARAMETER["Standard_Parallel_2",42.53333333333333],PARAMETER["Scale_Factor",1.000045],PARAMETER["Latitude_Of_Origin",42.53333333333333],UNIT["Foot_US",0.3048006096012192]]'
with fiona.open("./test.shp", "w", driver="ESRI Shapefile", schema=schema, crs=target_crs) as collection:
    collection.write(feature)

Solution: use WKT2. Need to do some research on how to do that.

@snowman2
Copy link
Contributor Author

Here is a workaround for anyone who might run into this:

Solution: use OSR_WKT_FORMAT="WKT2_2018" or OSR_WKT_FORMAT="WKT1_ESRI" with fiona.Env:

Write:

with fiona.Env(OSR_WKT_FORMAT="WKT2_2018"), fiona.open("./test.shp", "w", driver="ESRI Shapefile", schema=schema, crs=target_crs) as collection:
    collection.write(feature):

Read:

with fiona.Env(OSR_WKT_FORMAT="WKT2_2018"), fiona.open("./test.shp") as collection:
   print(collection.crs)

@mwtoews
Copy link
Member

mwtoews commented May 1, 2022

Closed by #979

@mwtoews mwtoews closed this as completed May 1, 2022
@mwtoews mwtoews added this to the 1.9 milestone May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants