-
Notifications
You must be signed in to change notification settings - Fork 215
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
Add JSON serializeability with PROJJSON? #1361
Comments
yes |
@hobu Can |
The CRS has |
Summary of options I have thought of: Option 1: Use Option 2: Use encoder #1361 (comment) import json
from pyproj import CRS
class PROJEncoder(json.JSONEncoder):
def default(self, obj):
try:
return crs.to_json_dict()
except AttributeError:
pass
return super().default(obj)
crs = CRS.from_user_input("EPSG:3857")
json.dumps(crs, cls=PROJEncoder) Option 3: Ask Python |
The |
Possiblity. Only thinking about one-way to encode to JSON at the moment as I don't think some things round-trip easily. |
I suppose Option #3 has been asked many times and there's some good reason for not implementing something like it over the years. Hopefully this ticket generates enough google juice for the next person and points them to use |
CRS objects are not JSON serializable:
I would have expected this to Just Work ™️ by using PROJJSON as the JSON i/o capability. This should work as lossless i/o in all be the rarest/weirdest situations, right @rouault?
The text was updated successfully, but these errors were encountered: