hackoregon / transportation-backend

Transportation backend repo - 2016 and 2017
8 stars 7 forks source link

API geometry field not to GeoJson spec #20

Closed sanjuroj closed 7 years ago

sanjuroj commented 7 years ago

The current API produces a non-compliant geometry:

{
    "type": "Feature",
    "geometry": "SRID=4326;LINESTRING (-122.5747233253109 45.55404608862442, -122.5712370220837 45.55546814153171, -122.5682305216262 45.55669265053297)",
    "properties": {}
}

It should be something like:

type: "feature",
geometry: {
        type: 'LineString',
        coordinates: [
          [-122.5747233253109, 45.55404608862442],
          [-122.5712370220837, 45.55546814153171],
          [-122.5682305216262, 45.55669265053297],
        ],
      },

I suspect this is a problem with the geometry model we are using, but I'm not sure, it could be a problem with the serializer.

sanjuroj commented 7 years ago

Fixed with commit fd7b1cfc. Needed to add rest_framework_gis to installed apps.