RESTful Service Profile - geometry Parameter

38 views
Skip to first unread message

Silvan Caduff

unread,
Jul 30, 2024, 8:23:54 AMJul 30
to GeoAdminCh API
I'm currently attempting to request profile data using a specific LineString for the geometry. However, I am facing difficulties in determining the correct format for the GeoJSON input required by the API. Below are the different variations of the request body that I have tried:

1.  Plain geometry data (which is obvious that it will not work, but anyway)
{
    "geom":  [[2550050, 1206550], [2556950, 1204150]]
}

2.  What i would expect to work
{
    "geom": {
        "type": "LineString",
        "coordinates": [[2550050, 1206550], [2556950, 1204150]]
    }
}

3. As a Feature LineString
{
    "type": "Feature",
    "geometry": {
        "type": "LineString",
        "coordinates": [[2550050, 1206550], [2556950, 1204150]]
    },
    "properties": {}
}

4. As a FeatureCollection
{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "LineString",
                "coordinates": [[2550050, 1206550], [2556950, 1204150]]
            },
            "properties": {}
        }
    ]
}
Despite these attempts, I am unable to obtain a successful response. I would expect that the second variation, which uses a standard GeoJSON LineString, should work based on common GeoJSON conventions. Could you please clarify the expected format for the geom parameter when using a LineString GeoJSON object? Additionally, if there are any specific requirements or common pitfalls associated with the API's handling of GeoJSON data, your insights would be greatly appreciated.
Reply all
Reply to author
Forward
0 new messages