umap-project / umap

uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.
https://umap-project.org
Other
1.11k stars 213 forks source link

Feature request: import a list of addresses #347

Open tuxayo opened 7 years ago

tuxayo commented 7 years ago

One possible implementation could be with Photon which would not only limit this type of import to addresses due to it's flexibility.

Manual proof of concept:

input data

IUT, Avenue Gaston Berger, aix
9, rue molidère, marseille

Corresponding queries

http://photon.komoot.de/api/?q=IUT,%20Avenue%20Gaston%20Berger,%20aix http://photon.komoot.de/api/?q=9,%20rue%20molid%C3%A8re,%20marseille

Merged GeoJSON

simplest approach: when the query returns multiple results under the key features, take the first and add it to the features of the result.

{

    "features": [
        {
            "geometry": {
                "coordinates": [
                    5.451482225137418,
                    43.514183599999996
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 28307932,
                "osm_type": "W",
                "extent": [
                    5.4504053,
                    43.5148486,
                    5.4525316,
                    43.5134649
                ],
                "country": "France",
                "osm_key": "amenity",
                "city": "Aix-en-Provence",
                "street": "Avenue Gaston Berger",
                "osm_value": "university",
                "postcode": "13090;13100",
                "name": "IUT d'Aix-Marseille (site Gaston Berger)",
                "state": "Provence-Alpes-Côte d'Azur"
            }
        },
        {

            "geometry": {
                "coordinates": [
                    5.3761492,
                    43.2935364
                ],
                "type": "Point"
            },
            "type": "Feature",
            "properties": {
                "osm_id": 2115086390,
                "osm_type": "N",
                "country": "France",
                "osm_key": "place",
                "housenumber": "9",
                "city": "Marseille",
                "street": "Rue Molière",
                "osm_value": "house",
                "postcode": "13001",
                "state": "Provence-Alpes-Côte d'Azur"
            }

        }
    ],
    "type": "FeatureCollection"
}

Resulting map

https://framacarte.org/en/map/untitled-map_4521#

yohanboniface commented 7 years ago

I'd suggest putting your addresses into a CSV, then using http://adresse.data.gouv.fr/csv/ to geocode them, then to upload the CSV in uMap.

tuxayo commented 7 years ago

My test queries where terribly geocoded (even the second one which is actually an address)but one should test with more addresses before being able to judge the quality of the geocoding. Anyway the result was directly importable in umap so it should definitely a usable alternative.

edit: I'm dumb and did a big typo, that's why the geocoding of the second query failed.

yohanboniface commented 7 years ago

(even the second one which is actually an address)

Is molidère its actual name or is it a typo?

tuxayo commented 7 years ago

Is molidère its actual name or is it a typo?

Damn it, it's a typo!

Which explains adresse.data.gouv.fr geocoding failure and shows Photon very good tolerance.

pyrog commented 7 years ago

I'd suggest putting your addresses into a CSV, then using http://adresse.data.gouv.fr/csv/ to geocode them, then to upload the CSV in uMap.

Could be fine for beginners to provide a geocoder 😄

See tools used in Data Visualization for All online book.