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

Ensure GEOSGeometry instances have srid #11366

Closed
whatisgalen opened this issue Aug 20, 2024 · 2 comments
Closed

Ensure GEOSGeometry instances have srid #11366

whatisgalen opened this issue Aug 20, 2024 · 2 comments

Comments

@whatisgalen
Copy link
Member

whatisgalen commented Aug 20, 2024

there are numerous places where an srid as a kwarg is hard-coded (typically 4326). There are also two kwargs in settings.py:

    PREFERRED_COORDINATE_SYSTEMS = (
    {
        "name": "Geographic",
        "srid": "4326",
        "proj4": "+proj=longlat +datum=WGS84 +no_defs",
        "default": True,
    },  # Required
    )

and

ANALYSIS_COORDINATE_SYSTEM_SRID = 3857  # Coord sys units must be meters

We should replace hard-coded references of 4326 with the first kwarg in settings, and wherever we instantiate a GEOSGeometry (or its extensions like Polygon) we should also set the srid like so:

Polygon(data, srid=int(settings.PREFERRED_COORDINATE_SYSTEMS[0].get("srid", 4326))

@whatisgalen
Copy link
Member Author

renaming this ticket to reflect the bug at stake: instances of GEOSGeometry and its extension classes like Polygon() should have an srid of 4326 unless specified otherwise

@whatisgalen whatisgalen changed the title standardize srid assignment Ensure GEOSGeometry instances have srid Aug 20, 2024
@whatisgalen whatisgalen changed the title Ensure GEOSGeometry instances have srid Ensure GEOSGeometry instances have srid Aug 20, 2024
@whatisgalen whatisgalen added Type: Bug Something isn't working bug labels Aug 20, 2024
whatisgalen added a commit that referenced this issue Aug 20, 2024
@whatisgalen whatisgalen removed the bug label Aug 22, 2024
@whatisgalen
Copy link
Member Author

closing this as the default srid for django GEOSGeometry classes

@github-project-automation github-project-automation bot moved this to ✅ Done in pipeline Aug 27, 2024
@whatisgalen whatisgalen removed the Type: Bug Something isn't working label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant