archesproject/arches

Ensure `GEOSGeometry` instances have srid

whatisgalen opened this issue · 2 comments

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))

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

closing this as the default srid for django GEOSGeometry classes