Skip to content

Access all fields including Contexts #169

@ollie10

Description

@ollie10

Hello everyone,

I'm trying to use the library to deserialize the result of some geocoding / reverse geocoding returned from the MapTiler API.

They claim their response type is a Standard GeoJson with a FeatureCollection and Features Array.

Now my question is: stating they have much more information like the OSM tags and the context array, how can I access those properties?

An example of returned data is this one:

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "ref": "osm:w186051440",
                "country_code": "sv",
                "kind": "street",
                "place_type_name": [
                    "dirección"
                ]
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -89.021450355649,
                    13.624615191117352
                ]
            },
            "bbox": [
                -89.02265902608632,
                13.623938743362018,
                -89.01993792504071,
                13.625057031669611
            ],
            "center": [
                -89.021450355649,
                13.624615191117352
            ],
            "place_name": "Calle El Amate, República de El Salvador",
            "place_type": [
                "address"
            ],
            "place_type_name": [
                "dirección"
            ],
            "relevance": 0.586667,
            "context": [
                {
                    "ref": "osm:n2823774053",
                    "country_code": "sv",
                    "kind": "place",
                    "osm:place_type": "village",
                    "id": "place.4177223",
                    "text": "San Miguel Tepezontes",
                    "text_es": "San Miguel Tepezontes"
                },
                {
                    "ref": "osm:r3624477",
                    "country_code": "sv",
                    "kind": "admin_area",
                    "id": "region.3368",
                    "text": "Departamento de La Paz",
                    "text_es": "Departamento de La Paz"
                },
                {
                    "ref": "osm:r1520612",
                    "country_code": "sv",
                    "kind": "admin_area",
                    "id": "country.1217",
                    "text": "República de El Salvador",
                    "language": "es",
                    "text_es": "República de El Salvador",
                    "language_es": "es"
                }
            ],
            "id": "address.25046469",
            "text": "Calle El Amate",
            "text_es": "Calle El Amate",
            "place_name_es": "Calle El Amate, San Miguel Tepezontes, Departamento de La Paz, República de El Salvador"
        }
    ],
    "query": [
        "calle",
        "el",
        "amate",
        "soyapango"
    ],
    "attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">&copy; MapTiler</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">&copy; OpenStreetMap contributors</a>"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions