Skip to content

Feature: Output as geojson Feature Collection - #86

Merged
ajnisbet merged 7 commits into
ajnisbet:devfrom
arnesetzer:geojsonOutput
Feb 19, 2024
Merged

ajnisbet merged 7 commits into
ajnisbet:devfrom
arnesetzer:geojsonOutput

Conversation

@arnesetzer

Copy link
Copy Markdown
Contributor

Heyo, I needed the geojson format for my project and thought it might be useful for someone else.
The parameter is set via config.yaml so that the format of the API can't be changed by mistake.

@ajnisbet

Copy link
Copy Markdown
Owner

Thank you for this! Geojson responses are something I would love to support. I have a few changes I'd like to make to your implementation though: I'll try and get to these over the next few weeks

  1. Use a FeatureCollection of Point, rather than a LineString. OTD can return a single point, whereas a LineString is only valid for 2 or more points. Also a LineString can't have individual properties.
  2. Return a complete valid geojson response (including type key) and removing the status key.
  3. Including the data source as a property. This also allows extending the response if the API changes in the future.
  4. Making the parameter selectable by url query option rather than server config (in the spirit of a RESTful API where the client can select the representation of the result).

So the complete response would be something like

{ "type": "FeatureCollection",
    "features": [
      { "type": "Feature",
        "geometry": {"type": "Point", "coordinates": [122.1, -42.1, 1234]},
        "properties": {"dataset": "test-dataset"}
      },
      { "type": "Feature",
        "geometry": {"type": "Point", "coordinates": [122.2, -42.1, 2345]},
        "properties": {"dataset": "test-dataset"}
      }
   ]
}

Would such a format still be useful for you?

@arnesetzer

arnesetzer commented Nov 14, 2023 •

Copy link
Copy Markdown
Contributor Author

Hi, thanks for your input. I'm working on it.

Would such a format still be useful for you?

Not really, but I already minimized the API to my needs (remove CORS-check, only allow POST jsonised, hardcoded values, etc.) so it doesn't matter 😄

@arnesetzer arnesetzer changed the title Feature: Optional output as geojson linestring Feature: Output as geojson Feature Collection Nov 14, 2023
@arnesetzer

Copy link
Copy Markdown
Contributor Author

Love the Lat-Lon or Lon-Lat discussion 😅

make test finishes without any errors, but I'm not familiar enough with pytest to write tests for the new case

@arnesetzer

Copy link
Copy Markdown
Contributor Author

Ready for review 😄

@ajnisbet

Copy link
Copy Markdown
Owner

Amazing thank you! I have seen this, will get it merged as soon as life allows.

@arnesetzer

Copy link
Copy Markdown
Contributor Author

@ajnisbet Any news here? 😃

@ajnisbet
ajnisbet changed the base branch from master to dev February 19, 2024 23:13
@ajnisbet
ajnisbet merged commit de7798f into ajnisbet:dev Feb 19, 2024
ajnisbet added a commit that referenced this pull request Feb 19, 2024
Fixes #86
@arnesetzer
arnesetzer deleted the geojsonOutput branch March 8, 2024 12:57
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

Successfully merging this pull request may close these issues.

2 participants