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

Make 'name' the default for 'crs_type' #117

Open
henri-hulski opened this issue Jan 27, 2022 · 3 comments
Open

Make 'name' the default for 'crs_type' #117

henri-hulski opened this issue Jan 27, 2022 · 3 comments

Comments

@henri-hulski
Copy link

Despite the docs link is still the default for the crs_type option.

You need to fix def get_crs(self):

    def get_crs(self):
        crs = {}
        crs_type = self.options.pop('crs_type', None)
        properties = {}
        if crs_type == "name":
            # todo: GeoJSON Spec: OGC CRS URNs such as "urn:ogc:def:crs:OGC:1.3:CRS84" shall be preferred over legacy identifiers such as "EPSG:4326":
            properties["name"] = "EPSG:%s" % (str(self.srid))
        else:  # preserve default behaviour
            crs_type = "link"
            properties["href"] = "http://spatialreference.org/ref/epsg/%s/" % (str(self.srid))
            properties["type"] = "proj4"
        crs["type"] = crs_type
        crs["properties"] = properties
        return crs
@henri-hulski
Copy link
Author

henri-hulski commented Jan 27, 2022

BTW are you planning to implement the todo from the above code?

@Gagaro
Copy link
Member

Gagaro commented Jan 28, 2022

The documentation is pointing to the view: https://github.com/makinacorpus/django-geojson/blob/master/djgeojson/views.py#L60

Did you have an issue with the default value in the serializer?

BTW are you planning to implement the todo from the above code?

This is a very old TODO and I'm not sure of the consequences. Feel free to open a PR if you have a better idea about what is needed here.

@henri-hulski
Copy link
Author

henri-hulski commented Jan 28, 2022

I'm using just the serializer for a geojson response. And when I don't set crs["type"] it uses link.
Beside that the serializer works great. Especially the field mapping is for me the main advantage to the native Django GeoJSON serializer.

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