Skip to content

Helper method and/or API route to join query results to geography #2003

@jc-harrison

Description

@jc-harrison

A common pattern when using FlowClient is to get the result of a spatially-aggregated query, get the corresponding geography data, and join them so they can be used together to create a map visualisation. This join is an extra step that the user has to implement themselves. The simplest way to do this is to load the geography geojson into a geopandas GeoDataFrame and join this to the pandas DataFrame query result, but geopandas is not a dependency of flowclient, and has its own dependencies that can sometimes cause conflicts, so some users may prefer not to use geopandas.

It would be useful to add an API route from which a user could get a geojson object with geography data and the results of one or more spatially-aggregated queries as properties. This could either be implemented as a new query kind, an additional parameter in the geography endpoint (which could take one or more query IDs to join), or a new API endpoint. I'd favour one of the last two options, since the data type returned (geojson) will be different from that of an ordinary query.

I expect this would also be useful in scenarios where a different application (such as a dashboard) is interacting with the API, and it would be convenient to get a single geojson object for visualisation purposes with minimal client-side manipulation of the results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FlowAPIIssues related to the FlowKit APIFlowClientIssues related to FlowClientFlowMachineIssues related to FlowMachineenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions