diff --git a/Tutoriel-geoparsing.ipynb b/Tutoriel-geoparsing.ipynb index 5acdd2ccada58e78e1b5aedfe6f510ee15dd9c1c..fd00acd435913b0d78a265c9d8193379f9a925aa 100644 --- a/Tutoriel-geoparsing.ipynb +++ b/Tutoriel-geoparsing.ipynb @@ -2106,16 +2106,159 @@ "### 6.2 Résolution de toponymes / désambiguïsation\n", "\n", "\n", - "#### 6.2.1 Exemple : Arques\n" + "#### 6.2.1 Exemple : Arques\n", + "\n", + "* Cherchons à localiser la ville `Arques`\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 62, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_be6124bcf640029daca852b2cbdb4231 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_be6124bcf640029daca852b2cbdb4231" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_be6124bcf640029daca852b2cbdb4231 = L.map(\n", + " "map_be6124bcf640029daca852b2cbdb4231",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_b9370e9f8be546bdc6580266e27d367d = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_be6124bcf640029daca852b2cbdb4231);\n", + " \n", + " \n", + " map_be6124bcf640029daca852b2cbdb4231.fitBounds(\n", + " [[50.739664, 2.306207], [50.739664, 2.306207]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_2397947c8ad71c3f6bb866e59390c38b_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_2397947c8ad71c3f6bb866e59390c38b = L.geoJson(null, {\n", + " onEachFeature: geo_json_2397947c8ad71c3f6bb866e59390c38b_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_2397947c8ad71c3f6bb866e59390c38b_add (data) {\n", + " geo_json_2397947c8ad71c3f6bb866e59390c38b\n", + " .addData(data)\n", + " .addTo(map_be6124bcf640029daca852b2cbdb4231);\n", + " }\n", + " geo_json_2397947c8ad71c3f6bb866e59390c38b_add({"features": [{"geometry": {"coordinates": [2.306207, 50.739664], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Saint-Omer, Pas-de-Calais, Hauts-de-France, France m\\u00e9tropolitaine, 62510, France", "type": "administrative"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_2397947c8ad71c3f6bb866e59390c38b.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2ea090ee0>" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "geocoder = Geocoder(sources=['ign'], max_rows=10)\n", + "geocoder = Geocoder()\n", "doc = geocoder('Arques')\n", "doc.get_folium_map()" ] @@ -2124,163 +2267,1974 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Exemple de requetes sans stratégies de désambiguisation" + "On remarque que par défaut, la localisation retournée pour le nom de lieu `Arques` n'est pas celle que l'on recherche. En effet, le texte indique qu'il s'agit d'une ville de Normandie hors ici la localisation proposée est située dans le Pas-de-Calais !\n", + "\n", + "Changeons les paramètres du `Geocoder` (ces paramètres sont similaires pour le `Geoparser`) pour essayer de retrouver la bonne localisation.\n", + "\n", + "* Augmenter le nombre de résultats retournés par les gazetiers interrogés" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", + "execution_count": 67, "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_147b68973bd8a4617348ab054d1515e8 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_147b68973bd8a4617348ab054d1515e8" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_147b68973bd8a4617348ab054d1515e8 = L.map(\n", + " "map_147b68973bd8a4617348ab054d1515e8",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_28748615e9f174a487f0d9f695c1261f = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_147b68973bd8a4617348ab054d1515e8);\n", + " \n", + " \n", + " map_147b68973bd8a4617348ab054d1515e8.fitBounds(\n", + " [[41.661452, -8.721672], [50.746125, 3.119602]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_8e2a0159718eca287c433a12e1b757de_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_8e2a0159718eca287c433a12e1b757de = L.geoJson(null, {\n", + " onEachFeature: geo_json_8e2a0159718eca287c433a12e1b757de_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_8e2a0159718eca287c433a12e1b757de_add (data) {\n", + " geo_json_8e2a0159718eca287c433a12e1b757de\n", + " .addData(data)\n", + " .addTo(map_147b68973bd8a4617348ab054d1515e8);\n", + " }\n", + " geo_json_8e2a0159718eca287c433a12e1b757de_add({"features": [{"geometry": {"coordinates": [2.306207, 50.739664], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Saint-Omer, Pas-de-Calais, Hauts-de-France, France m\\u00e9tropolitaine, 62510, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [2.374819, 42.952872], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Limoux, Aude, Occitanie, France m\\u00e9tropolitaine, 11190, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [2.799134, 44.317619], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Millau, Aveyron, Occitanie, France m\\u00e9tropolitaine, 12290, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [1.648002, 44.968669], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Strenquels, Gourdon, Lot, Occitanie, France m\\u00e9tropolitaine, 46110, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [-8.721672, 41.661452], "type": "Point"}, "properties": {"country": "Portugal", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Vila de Punhe, Viana do Castelo, 4905-643, Portugal", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [3.119602, 44.004793], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Lapanouse-de-Cernon, Millau, Aveyron, Occitanie, France m\\u00e9tropolitaine, 12230, France", "type": "isolated_dwelling"}, "type": "Feature"}, {"geometry": {"coordinates": [2.320674, 50.746125], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques (Parc naturel r\\u00e9gional des caps et marais d\\u0027Opale), Arques, Saint-Omer, Pas-de-Calais, Hauts-de-France, France m\\u00e9tropolitaine, 62510, France", "type": "admin_fraction"}, "type": "Feature"}, {"geometry": {"coordinates": [2.05149, 42.812241], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Galinagues, Limoux, Aude, Occitanie, France m\\u00e9tropolitaine, 11140, France", "type": "locality"}, "type": "Feature"}, {"geometry": {"coordinates": [0.252495, 43.245551], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arqu\\u00e8s, Goudon, Tarbes, Hautes-Pyr\\u00e9n\\u00e9es, Occitanie, France m\\u00e9tropolitaine, 65190, France", "type": "locality"}, "type": "Feature"}, {"geometry": {"coordinates": [2.302074, 50.728092], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "nominatim", "sourceName": "Arques, Rue de Boulogne, Arques, Saint-Omer, Pas-de-Calais, Hauts-de-France, France m\\u00e9tropolitaine, 62510, France", "type": "station"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_8e2a0159718eca287c433a12e1b757de.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2d7067910>" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "geocoder = Geocoder(max_rows=10)\n", + "doc = geocoder('Arques')\n", + "doc.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On observe parmi les 10 localisations retournées par OpenStreetMap (gazetier par défaut) qu'aucune ne se situe en Normandie.\n", + "\n", + "* Remplacer OpenStreetMap par l'IGN" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_dbd840986bf0902bc4b8155da08ddc99 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_dbd840986bf0902bc4b8155da08ddc99" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_dbd840986bf0902bc4b8155da08ddc99 = L.map(\n", + " "map_dbd840986bf0902bc4b8155da08ddc99",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_e7e286511395268233aaa50b6fe19ca2 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_dbd840986bf0902bc4b8155da08ddc99);\n", + " \n", + " \n", + " map_dbd840986bf0902bc4b8155da08ddc99.fitBounds(\n", + " [[42.734711, 1.544996], [42.734711, 1.544996]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_1b868beb5b1893a2cd9654b8c6102169_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_1b868beb5b1893a2cd9654b8c6102169 = L.geoJson(null, {\n", + " onEachFeature: geo_json_1b868beb5b1893a2cd9654b8c6102169_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_1b868beb5b1893a2cd9654b8c6102169_add (data) {\n", + " geo_json_1b868beb5b1893a2cd9654b8c6102169\n", + " .addData(data)\n", + " .addTo(map_dbd840986bf0902bc4b8155da08ddc99);\n", + " }\n", + " geo_json_1b868beb5b1893a2cd9654b8c6102169_add({"features": [{"geometry": {"coordinates": [1.544996, 42.734711], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Siguer", "type": "Versant"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_1b868beb5b1893a2cd9654b8c6102169.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2d7074730>" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "geocoder = Geocoder(sources=['ign'])\n", + "doc = geocoder('Arques')\n", + "doc.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On observe que le premier résultat retourné par l'IGN ne se situe ni en Normandie (comme attendu), ni dans le Pas-de-Calais comme le premier résultat retourné par OpenStreetMap.\n", + "\n", + "* Augmenter le nombre de résultats retournés par l'IGN" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_46429928ee4bb195ccc43e51bb0faa68 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_46429928ee4bb195ccc43e51bb0faa68" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_46429928ee4bb195ccc43e51bb0faa68 = L.map(\n", + " "map_46429928ee4bb195ccc43e51bb0faa68",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_e4163f67394617bad21dd8885fb1d484 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_46429928ee4bb195ccc43e51bb0faa68);\n", + " \n", + " \n", + " map_46429928ee4bb195ccc43e51bb0faa68.fitBounds(\n", + " [[42.734711, 0.253068], [50.733882, 2.799876]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_eda3647008bc9fd3c836bd1839931f40_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_eda3647008bc9fd3c836bd1839931f40 = L.geoJson(null, {\n", + " onEachFeature: geo_json_eda3647008bc9fd3c836bd1839931f40_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_eda3647008bc9fd3c836bd1839931f40_add (data) {\n", + " geo_json_eda3647008bc9fd3c836bd1839931f40\n", + " .addData(data)\n", + " .addTo(map_46429928ee4bb195ccc43e51bb0faa68);\n", + " }\n", + " geo_json_eda3647008bc9fd3c836bd1839931f40_add({"features": [{"geometry": {"coordinates": [1.544996, 42.734711], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Siguer", "type": "Versant"}, "type": "Feature"}, {"geometry": {"coordinates": [2.376764, 42.952434], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Arques", "type": "Commune"}, "type": "Feature"}, {"geometry": {"coordinates": [2.799876, 44.317956], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Arques", "type": "Commune"}, "type": "Feature"}, {"geometry": {"coordinates": [1.250132, 43.293669], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Marquefave", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.647947, 44.968879], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Strenquels", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.294824, 50.733882], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Arques", "type": "Commune"}, "type": "Feature"}, {"geometry": {"coordinates": [0.253068, 43.245235], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Goudon", "type": "Lieu-dit non habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.792246, 44.065762], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Viala-du-Tarn", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.793915, 44.068551], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Viala-du-Tarn", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.125078, 49.880248], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Arques", "source": "ign", "sourceName": "Arques-la-Bataille", "type": "Commune"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_eda3647008bc9fd3c836bd1839931f40.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2e81b0100>" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "geocoder = Geocoder(sources=['ign'], max_rows=10)\n", + "doc = geocoder('Arques')\n", + "doc.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Cette fois-ci on retrouve bien une localisation en Normandie au sud de Dieppe avec pour nom `Arques-la-Bataille'. On peut faire l'hypotèse que le nom a évolué car cette localisation se situe bien dans le Pays de Caux (voir illustration ci-dessous, source [Wikipedia](https://fr.wikipedia.org/wiki/Pays_de_Caux)) comme l'indique le texte de l'article.\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Il reste néanmoins le problème de retrouver cette localisation de manière automatique. \n", + "Plusieurs approches existent dans la littérature mais ne sont pas encore implémentées dans `Perdido`.\n", + "\n", + "Cet exemple illustre bien la difficulté de la problématique de désambiguïsation des toponymes avec notamment la gestion des natures de lieux différentes (pays, régions, communes, lieux-dits, lac, rivières, etc.) associés à un même nom, l'homonymie, la non exaustivité des ressources, l'évolution des noms au cours du temps ou encore les erreurs d'orthographe." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Afficher la carte obtenue après le geoparsing avec l'IGN et 10 résultats max par nom de lieu" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_2f0c11ee659bebebb73f5ace63d9efc0 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_2f0c11ee659bebebb73f5ace63d9efc0" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_2f0c11ee659bebebb73f5ace63d9efc0 = L.map(\n", + " "map_2f0c11ee659bebebb73f5ace63d9efc0",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_e722ba722b5a3bfd4cddc51cf8ded6bb = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_2f0c11ee659bebebb73f5ace63d9efc0);\n", + " \n", + " \n", + " map_2f0c11ee659bebebb73f5ace63d9efc0.fitBounds(\n", + " [[43.079622, -4.068862], [50.130325, 5.821841]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_668bf5efb10db7221ebe4ddb6f95ce3b_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_668bf5efb10db7221ebe4ddb6f95ce3b = L.geoJson(null, {\n", + " onEachFeature: geo_json_668bf5efb10db7221ebe4ddb6f95ce3b_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_668bf5efb10db7221ebe4ddb6f95ce3b_add (data) {\n", + " geo_json_668bf5efb10db7221ebe4ddb6f95ce3b\n", + " .addData(data)\n", + " .addTo(map_2f0c11ee659bebebb73f5ace63d9efc0);\n", + " }\n", + " geo_json_668bf5efb10db7221ebe4ddb6f95ce3b_add({"features": [{"geometry": {"coordinates": [5.096652, 45.869265], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Bressolles", "type": "Quartier"}, "type": "Feature"}, {"geometry": {"coordinates": [5.354185, 46.233164], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Meillonnas", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [5.67897, 44.471041], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "La Piarre", "type": "Bois"}, "type": "Feature"}, {"geometry": {"coordinates": [2.175565, 43.079622], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Gaja-et-Villedieu", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.789769, 43.233532], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Saint-Sernin", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [5.577606, 43.570891], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Vauvenargues", "type": "Ruines"}, "type": "Feature"}, {"geometry": {"coordinates": [-0.848019, 45.603663], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Gr\\u00e9zac", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [-0.581724, 45.494817], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Bois", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.617984, 45.368456], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Lagrauli\\u00e8re", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [0.941046, 43.167396], "type": "Point"}, "properties": {"country": "France", "id": "en.5", "name": "France", "source": "ign", "sourceName": "Mancioux", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [4.851823, 50.130325], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Givet", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.447184, 44.723667], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Junhac", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [-0.855164, 46.246698], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Saint-Jean-de-Liversay", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [-2.743228, 48.323177], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Pl\\u0153uc-L\\u0027Hermitage", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.102508, 49.443031], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Rouen", "type": "R\\u00e9gion"}, "type": "Feature"}, {"geometry": {"coordinates": [-4.068862, 48.297443], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Pont-de-Buis-l\\u00e8s-Quimerch", "type": "Lieu-dit non habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [-1.64847, 48.231258], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Melesse", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [5.821841, 47.307332], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Brussey", "type": "Lieu-dit non habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.90554, 48.223278], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Lorrez-le-Bocage-Pr\\u00e9aux", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.240619, 44.159185], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Normandie", "source": "ign", "sourceName": "Lafran\\u00e7aise", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.553925, 46.432375], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "La Chapelaude", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.255493, 43.225454], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Caux-et-Sauzens", "type": "Commune"}, "type": "Feature"}, {"geometry": {"coordinates": [2.047133, 45.725903], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Peyrelevade", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.039653, 45.401722], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "\\u00c9gletons", "type": "Quartier"}, "type": "Feature"}, {"geometry": {"coordinates": [1.888828, 45.30495], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Saint-Priest-de-Gimel", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [1.787262, 46.284578], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "La Celle-Dunoise", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [3.368457, 43.50344], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Caux", "type": "Commune"}, "type": "Feature"}, {"geometry": {"coordinates": [3.448328, 45.208555], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Saint-Privat-du-Dragon", "type": "Bois"}, "type": "Feature"}, {"geometry": {"coordinates": [1.13549, 44.381744], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Montcuq-en-Quercy-Blanc", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}, {"geometry": {"coordinates": [2.684528, 45.458418], "type": "Point"}, "properties": {"country": "France", "id": "en.11", "name": "Caux", "source": "ign", "sourceName": "Saint-Donat", "type": "Lieu-dit habit\\u00e9"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_668bf5efb10db7221ebe4ddb6f95ce3b.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2ea1e3280>" + ] + }, + "execution_count": 79, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "geoparser = Geoparser(sources=['ign'], max_rows=10)\n", + "doc = geoparser(content)\n", + "doc.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "### 6.3 Le cas des descriptions de randonnées\n", + "\n", + "Prenons maintenant l'exemple du geoparsing de descriptions de randonnées. Certaines solutions de désambiguisation ont pu être développées et intégrées au sein de la librairie `Perdido` (ou en cours d'intégration). Les solutions décrites dans la suite de cette partie ont été développées dans le cadre des projets [Perdido](http://erig.univ-pau.fr/PERDIDO/) (2012-2015) et [ANR CHOUCAS](http://choucas.ign.fr) (2017-2022). \n", + "\n", + "> Ludovic Moncla, Walter Renteria-Agualimpia, Javier Nogueras-Iso and Mauro Gaio (2014). \"Geocoding for texts with fine-grain toponyms: an experiment on a geoparsed hiking descriptions corpus\". In Proceedings of the 22nd ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, pp 183-192.\n", + "\n", + "> Mauro Gaio and Ludovic Moncla (2019). “Geoparsing and geocoding places in a dynamic space context.“ In The Semantics of Dynamic Space in French: Descriptive, experimental and formal studies on motion expression, 66, 353.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Charger le jeu de données CHOUCAS de descriptions de randonnées fourni par `Perdido`" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div>\n", + "<style scoped>\n", + " .dataframe tbody tr th:only-of-type {\n", + " vertical-align: middle;\n", + " }\n", + "\n", + " .dataframe tbody tr th {\n", + " vertical-align: top;\n", + " }\n", + "\n", + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "</style>\n", + "<table border=\"1\" class=\"dataframe\">\n", + " <thead>\n", + " <tr style=\"text-align: right;\">\n", + " <th></th>\n", + " <th>name</th>\n", + " <th>text</th>\n", + " <th>geometry</th>\n", + " <th>#_places</th>\n", + " <th>#_person</th>\n", + " <th>#_event</th>\n", + " <th>#_date</th>\n", + " <th>#_misc</th>\n", + " <th>#_locations</th>\n", + " </tr>\n", + " </thead>\n", + " <tbody>\n", + " <tr>\n", + " <th>0</th>\n", + " <td>Chalets de la Fullie</td>\n", + " <td>\\n\\nBoucle des chalets de la Fullie au départ ...</td>\n", + " <td>(LINESTRING (6.11174 45.616041, 6.11174 45.616...</td>\n", + " <td>17</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>17</td>\n", + " </tr>\n", + " <tr>\n", + " <th>1</th>\n", + " <td>Traversée cabane de Pravouta à la Plagne</td>\n", + " <td>\\n\\nPartir de la cabane de Pravouta juste de l...</td>\n", + " <td>(LINESTRING (5.832543 45.315222, 5.832444 45.3...</td>\n", + " <td>23</td>\n", + " <td>2</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>23</td>\n", + " </tr>\n", + " <tr>\n", + " <th>2</th>\n", + " <td>Refuge Entre Le Lac - Refuge de la Leisse</td>\n", + " <td>\\n\\nDépart du refuge d'Entre le Lac près du la...</td>\n", + " <td>(LINESTRING (6.839184 45.480323, 6.83987 45.47...</td>\n", + " <td>22</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>22</td>\n", + " </tr>\n", + " <tr>\n", + " <th>3</th>\n", + " <td>Le lac du Retour</td>\n", + " <td>\\n\\nDu parking de Pierre Giret, suivre la rout...</td>\n", + " <td>(LINESTRING (6.917631 45.619278, 6.917527 45.6...</td>\n", + " <td>6</td>\n", + " <td>1</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>6</td>\n", + " </tr>\n", + " <tr>\n", + " <th>4</th>\n", + " <td>Traversée Alpette - Dent de Crolles</td>\n", + " <td>\\n</td>\n", + " <td>(LINESTRING (5.907402 45.440585, 5.907439 45.4...</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " <td>0</td>\n", + " </tr>\n", + " </tbody>\n", + "</table>\n", + "</div>" + ], + "text/plain": [ + " name \\\n", + "0 Chalets de la Fullie \n", + "1 Traversée cabane de Pravouta à la Plagne \n", + "2 Refuge Entre Le Lac - Refuge de la Leisse \n", + "3 Le lac du Retour \n", + "4 Traversée Alpette - Dent de Crolles \n", + "\n", + " text \\\n", + "0 \\n\\nBoucle des chalets de la Fullie au départ ... \n", + "1 \\n\\nPartir de la cabane de Pravouta juste de l... \n", + "2 \\n\\nDépart du refuge d'Entre le Lac près du la... \n", + "3 \\n\\nDu parking de Pierre Giret, suivre la rout... \n", + "4 \\n \n", + "\n", + " geometry #_places #_person \\\n", + "0 (LINESTRING (6.11174 45.616041, 6.11174 45.616... 17 0 \n", + "1 (LINESTRING (5.832543 45.315222, 5.832444 45.3... 23 2 \n", + "2 (LINESTRING (6.839184 45.480323, 6.83987 45.47... 22 0 \n", + "3 (LINESTRING (6.917631 45.619278, 6.917527 45.6... 6 1 \n", + "4 (LINESTRING (5.907402 45.440585, 5.907439 45.4... 0 0 \n", + "\n", + " #_event #_date #_misc #_locations \n", + "0 0 0 0 17 \n", + "1 0 0 0 23 \n", + "2 0 0 0 22 \n", + "3 0 0 0 6 \n", + "4 0 0 0 0 " + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dataset_choucas = load_choucas_perdido()\n", + "data_choucas = dataset_choucas['data']\n", + "\n", + "\n", + "data_choucas.to_dataframe().head()" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "30" + ] + }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(data_choucas)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "* Sélectionner une randonnée (parmi les 30)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [], + "source": [ + "id_rando = 2\n", + "doc = data_choucas[id_rando]" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"\\n\\nDépart du refuge d'Entre le Lac près du lac de la Plagne.\\nDu refuge Entre le Lac, un sentier remonte les pentes herbeuses et permet de rejoindre le GR5 un peu avant le chalet de la Grassaz (chalet du berger 2335m). Toujours en direction du sud, on remonte le vallon en longeant le ruisseau. On parvient ainsi à l'extrémité ouest du lac de Grattaleu; un peu plus haut, on atteint le refuge du col du Palet (2550m). On admire la beauté de la vallée et le sommet de Bellecote recouvert de glaciers. Le GR descend vers l'Est; le sentier serpente entre des entonnoirs créés dans le gypse par dissolution. Le GR passe sous un 1er télésiège, celui de Grattaleu, et près de l'arrivée d'un second, le Tichot. Au chalet de Lognan (croix) prendre à droite un sentier qui descend à Val Claret (2107m) (station de ski). Poursuivre jusqu'au chalet de la Leisse. Le GR55 s'élève vers le vallon du paquis. On passe en contrebas du chalet du Prariond; un peu plus loin on arrive à la bifurcation du col de Fresse (2531m). Laisser à gauche le sentier montant au col de Fresse (2576m), le GR55 continue sud sud ouest dans un décor sauvage entre le massif de la Grande motte et la pointe du Grand Pré; il grimpe parmi des rochers: les balises peuvent être des cairns; bien être attentif pour bien les suivre jusqu'au col de la Leisse (2758 m). Le GR55 descend dans une zone d'éboulis, bien suivre les cairns, par une piste peu visible. Ensuite, il longe le lac des Nettes dans un univers très minéral sur sa rive et pour en atteindre l'extrémité sud. On retrouve dans les alpages le sentier bien tracé qui parcourt le plan des Nettes sur la rive droite du torrent. Peu après un petit barrage qui est en cours de destruction, on arrive au refuge de la Leisse (2487m).\\n\\n\\n\\n\"" + ] + }, + "execution_count": 109, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc.text" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<span class=\"tex2jax_ignore\"><div class=\"entities\" style=\"line-height: 2.5; direction: ltr\">Départ du refuge d' Entre le Lac près du lac de la \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Plagne\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " . Du refuge Entre le Lac , un sentier remonte les pentes herbeuses et permet de rejoindre le GR5 un peu avant le chalet de la \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Grassaz\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( chalet du \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " berger\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " 2335m ) . Toujours en direction du sud , on remonte le vallon en longeant le ruisseau . On parvient ainsi à l' extrémité ouest du lac de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Grattaleu\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ; un peu plus haut , on atteint le refuge du \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " col\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " du \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Palet\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2550m ) . On admire la beauté de la vallée et le sommet de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Bellecote\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " recouvert de glaciers . Le \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " GR\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " descend vers l' Est ; le sentier serpente entre des entonnoirs créés dans le gypse par dissolution . Le \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " GR\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " passe sous un 1er télésiège , celui de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Grattaleu\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " , et près de l' arrivée d' un second , le \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Tichot\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " . Au chalet de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Lognan\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( croix ) prendre à droite un sentier qui descend à Val \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Claret\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2107m ) ( station de ski ) . Poursuivre jusqu' au chalet de la \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Leisse\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " . Le \n", + "<mark class=\"entity\" style=\"background: #ddd; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " GR55\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">MISC</span>\n", + "</mark>\n", + " s' élève vers le vallon du \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " paquis\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " . On passe en contrebas du chalet du \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Prariond\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ; un peu plus loin on arrive à la bifurcation du col de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Fresse\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2531m ) . Laisser à gauche le sentier montant au col de \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Fresse\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2576m ) , le \n", + "<mark class=\"entity\" style=\"background: #ddd; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " GR55\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">MISC</span>\n", + "</mark>\n", + " continue sud sud ouest dans un décor sauvage entre le massif de la \n", + "<mark class=\"entity\" style=\"background: #ddd; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Grande\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">MISC</span>\n", + "</mark>\n", + " motte et la pointe du Grand Pré ; il grimpe parmi des rochers : les balises peuvent être des cairns ; bien être attentif pour bien les suivre jusqu' au col de la \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Leisse\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2758 m ) . Le \n", + "<mark class=\"entity\" style=\"background: #ddd; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " GR55\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">MISC</span>\n", + "</mark>\n", + " descend dans une zone d' éboulis , bien suivre les cairns , par une piste peu visible . Ensuite , il longe le lac des \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Nettes\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " dans un univers très minéral sur sa rive et pour en atteindre l' extrémité sud . On retrouve dans les alpages le sentier bien tracé qui parcourt le plan des \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Nettes\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " sur la rive droite du torrent . Peu après un petit barrage qui est en cours de destruction , on arrive au refuge de la \n", + "<mark class=\"entity\" style=\"background: #ff9561; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em;\">\n", + " Leisse\n", + " <span style=\"font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; vertical-align: middle; margin-left: 0.5rem\">LOC</span>\n", + "</mark>\n", + " ( 2487m ) . </div></span>" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "displacy.render(doc.to_spacy_doc(), style=\"ent\", jupyter=True) " + ] + }, + { + "cell_type": "code", + "execution_count": 126, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_70b18832967330e906b27f597aeb9732 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_70b18832967330e906b27f597aeb9732" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_70b18832967330e906b27f597aeb9732 = L.map(\n", + " "map_70b18832967330e906b27f597aeb9732",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_93867c68e8bb29f0913303d071cc33d8 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_70b18832967330e906b27f597aeb9732);\n", + " \n", + " \n", + "\n", + " function geo_json_c9dc27ac7a26440e2debd813aa954813_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_c9dc27ac7a26440e2debd813aa954813 = L.geoJson(null, {\n", + " onEachFeature: geo_json_c9dc27ac7a26440e2debd813aa954813_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_c9dc27ac7a26440e2debd813aa954813_add (data) {\n", + " geo_json_c9dc27ac7a26440e2debd813aa954813\n", + " .addData(data)\n", + " .addTo(map_70b18832967330e906b27f597aeb9732);\n", + " }\n", + " geo_json_c9dc27ac7a26440e2debd813aa954813_add({"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "features": [{"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "geometry": {"coordinates": [[[6.839184, 45.480323], [6.83987, 45.479299], [6.841973, 45.478562], [6.843969, 45.47857], [6.845235, 45.479931], [6.847187, 45.479675], [6.847766, 45.480112], [6.848368, 45.479932], [6.849569, 45.480172], [6.850213, 45.479029], [6.850685, 45.477254], [6.8509, 45.476306], [6.851114, 45.474425], [6.851758, 45.472889], [6.853217, 45.471626], [6.855106, 45.46982], [6.855534, 45.468766], [6.855191, 45.468014], [6.85605, 45.46684], [6.856092, 45.464914], [6.856049, 45.463891], [6.855663, 45.462356], [6.856093, 45.461679], [6.856822, 45.46137], [6.857122, 45.460038], [6.857166, 45.458864], [6.857724, 45.458021], [6.858754, 45.457765], [6.859698, 45.458503], [6.860513, 45.458097], [6.861564, 45.458676], [6.861575, 45.457732], [6.860641, 45.456396], [6.864246, 45.456245], [6.865748, 45.455944], [6.867508, 45.455763], [6.869139, 45.455884], [6.870942, 45.456034], [6.875319, 45.454649], [6.879224, 45.455432], [6.881391, 45.454996], [6.883816, 45.455463], [6.886091, 45.455613], [6.887936, 45.456004], [6.890725, 45.457841], [6.890789, 45.45608], [6.891379, 45.454687], [6.892742, 45.454379], [6.894287, 45.453084], [6.896261, 45.45191], [6.896733, 45.452663], [6.898192, 45.452602], [6.899759, 45.453009], [6.90184, 45.452392], [6.902398, 45.451308], [6.903771, 45.450827], [6.905102, 45.450525], [6.906303, 45.451308], [6.909179, 45.449742], [6.911582, 45.448568], [6.913986, 45.447755], [6.916839, 45.44619], [6.917944, 45.444971], [6.920036, 45.444083], [6.92214, 45.441493], [6.921732, 45.440138], [6.91921, 45.437713], [6.916174, 45.435741], [6.915831, 45.433859], [6.915701, 45.432067], [6.914092, 45.430877], [6.912398, 45.429567], [6.912054, 45.428845], [6.910767, 45.428423], [6.910209, 45.4277], [6.910423, 45.427038], [6.908664, 45.425321], [6.906861, 45.423603], [6.905509, 45.42261], [6.903985, 45.421586], [6.904544, 45.420486], [6.904587, 45.418784], [6.903986, 45.41779], [6.9039, 45.416254], [6.904393, 45.414838], [6.9042, 45.413301], [6.902741, 45.411855], [6.90081, 45.411524], [6.900123, 45.410636], [6.90111, 45.409476], [6.901003, 45.408707], [6.900349, 45.408564], [6.900064, 45.409095], [6.899343, 45.408773], [6.89742, 45.408511], [6.893514, 45.404624], [6.890639, 45.403811], [6.889116, 45.403374], [6.887592, 45.402576], [6.886176, 45.401822], [6.886262, 45.400858], [6.886444, 45.400128], [6.887142, 45.4], [6.88652, 45.399201], [6.885339, 45.398297], [6.885704, 45.397966], [6.88403, 45.397318], [6.88227, 45.396851]]], "type": "MultiLineString"}, "id": "0", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " map_70b18832967330e906b27f597aeb9732.fitBounds(\n", + " [[45.412971, 6.837532], [45.462018, 6.963285]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_6d5300315b25fd6c35618511577f3679_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_6d5300315b25fd6c35618511577f3679 = L.geoJson(null, {\n", + " onEachFeature: geo_json_6d5300315b25fd6c35618511577f3679_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_6d5300315b25fd6c35618511577f3679_add (data) {\n", + " geo_json_6d5300315b25fd6c35618511577f3679\n", + " .addData(data)\n", + " .addTo(map_70b18832967330e906b27f597aeb9732);\n", + " }\n", + " geo_json_6d5300315b25fd6c35618511577f3679_add({"features": [{"geometry": {"coordinates": [6.837532, 45.456069], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.456069, "longitude": 6.837532, "name": "Grassaz", "source": "nominatim", "sourceName": "Col de la Grassaz, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "xmlID": "en.7"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.461481, "longitude": 6.858926, "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "xmlID": "en.15"}, "type": "Feature"}, {"geometry": {"coordinates": [6.863067, 45.451642], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.451642, "longitude": 6.863067, "name": "Palet", "source": "nominatim", "sourceName": "Signal du Palet, Champagny-en-Vanoise, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73350, France", "xmlID": "en.22"}, "type": "Feature"}, {"geometry": {"coordinates": [6.963285, 45.462018], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.462018, "longitude": 6.963285, "name": "Bellecote", "source": "nominatim", "sourceName": "Bellecote, Sentier de la Vall\\u00e9e Perdue, Le Cr\\u00eat, La Daille, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.26"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.461481, "longitude": 6.858926, "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "xmlID": "en.32"}, "type": "Feature"}, {"geometry": {"coordinates": [6.896874, 45.454039], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.454039, "longitude": 6.896874, "name": "Tichot", "source": "nominatim", "sourceName": "Tichot, Tarte \\u00e0 Lognan, Val-Claret, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "xmlID": "en.34"}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.419228, "longitude": 6.898275, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.46"}, "type": "Feature"}, {"geometry": {"coordinates": [6.914334, 45.458216], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.458216, "longitude": 6.914334, "name": "paquis", "source": "nominatim", "sourceName": "Paquis, GunPowder, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "xmlID": "en.52"}, "type": "Feature"}, {"geometry": {"coordinates": [6.92583, 45.442088], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.442088, "longitude": 6.92583, "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, Piste du Col de Fresse, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.62"}, "type": "Feature"}, {"geometry": {"coordinates": [6.92583, 45.442088], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.442088, "longitude": 6.92583, "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, Piste du Col de Fresse, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.66"}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.419228, "longitude": 6.898275, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.76"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.412971, "longitude": 6.89952, "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "xmlID": "en.82"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.412971, "longitude": 6.89952, "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "xmlID": "en.86"}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.419228, "longitude": 6.898275, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": "en.90"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_6d5300315b25fd6c35618511577f3679.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2f1fb9af0>" + ] + }, + "execution_count": 126, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On observe ici le résultat déjà pré-traité par `Perdido`. Nous allons maintenant illustrer le processus de désambiguïsation." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On recommence le processus de geoparsing en entier à partir du texte de la randonnées choisie." + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "metadata": {}, + "outputs": [], + "source": [ + "geoparser = Geoparser()\n", + "doc_geoparsed = geoparser(doc.text)" + ] + }, + { + "cell_type": "code", + "execution_count": 129, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_3be5297bcda82ebe8c95fa85e5b69029 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_3be5297bcda82ebe8c95fa85e5b69029" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_3be5297bcda82ebe8c95fa85e5b69029 = L.map(\n", + " "map_3be5297bcda82ebe8c95fa85e5b69029",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_9b3df20b0a14d61cf597cfb63f05e725 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_3be5297bcda82ebe8c95fa85e5b69029);\n", + " \n", + " \n", + " map_3be5297bcda82ebe8c95fa85e5b69029.fitBounds(\n", + " [[38.674213, -91.338769], [53.582329, 21.987713]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_7e7065bb4d17ca5707a88375cf728cfd_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_7e7065bb4d17ca5707a88375cf728cfd = L.geoJson(null, {\n", + " onEachFeature: geo_json_7e7065bb4d17ca5707a88375cf728cfd_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_7e7065bb4d17ca5707a88375cf728cfd_add (data) {\n", + " geo_json_7e7065bb4d17ca5707a88375cf728cfd\n", + " .addData(data)\n", + " .addTo(map_3be5297bcda82ebe8c95fa85e5b69029);\n", + " }\n", + " geo_json_7e7065bb4d17ca5707a88375cf728cfd_add({"features": [{"geometry": {"coordinates": [1.060214, 43.157123], "type": "Point"}, "properties": {"country": "France", "id": "en.3", "name": "Plagne", "source": "nominatim", "sourceName": "Plagne, Muret, Haute-Garonne, Occitanie, France m\\u00e9tropolitaine, 31220, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [6.837532, 45.456069], "type": "Point"}, "properties": {"country": "France", "id": "en.7", "name": "Grassaz", "source": "nominatim", "sourceName": "Col de la Grassaz, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [-91.338769, 38.674213], "type": "Point"}, "properties": {"country": "United States", "id": "en.11", "name": "berger", "source": "nominatim", "sourceName": "Berger, Franklin County, Missouri, United States", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"country": "France", "id": "en.15", "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.959974, 50.938361], "type": "Point"}, "properties": {"country": "Deutschland", "id": "en.20", "name": "col", "source": "nominatim", "sourceName": "K\\u00f6ln, Nordrhein-Westfalen, Deutschland", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [-1.244805, 48.200191], "type": "Point"}, "properties": {"country": "France", "id": "en.22", "name": "Palet", "source": "nominatim", "sourceName": "Palet, Taillis, Foug\\u00e8res-Vitr\\u00e9, Ille-et-Vilaine, Bretagne, France m\\u00e9tropolitaine, 35500, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [6.963285, 45.462018], "type": "Point"}, "properties": {"country": "France", "id": "en.26", "name": "Bellecote", "source": "nominatim", "sourceName": "Bellecote, Sentier de la Vall\\u00e9e Perdue, Le Cr\\u00eat, La Daille, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [21.987713, 38.995368], "type": "Point"}, "properties": {"country": "\\u0395\\u03bb\\u03bb\\u03ac\\u03c2", "id": "en.28", "name": "GR", "source": "nominatim", "sourceName": "\\u0395\\u03bb\\u03bb\\u03ac\\u03c2", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [21.987713, 38.995368], "type": "Point"}, "properties": {"country": "\\u0395\\u03bb\\u03bb\\u03ac\\u03c2", "id": "en.30", "name": "GR", "source": "nominatim", "sourceName": "\\u0395\\u03bb\\u03bb\\u03ac\\u03c2", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"country": "France", "id": "en.32", "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.896874, 45.454039], "type": "Point"}, "properties": {"country": "France", "id": "en.34", "name": "Tichot", "source": "nominatim", "sourceName": "Tichot, Tarte \\u00e0 Lognan, Val-Claret, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.926505, 45.978552], "type": "Point"}, "properties": {"country": "France", "id": "en.38", "name": "Lognan", "source": "nominatim", "sourceName": "Lognan, Chemin de la Glaci\\u00e8re, Les Chosalets, Argenti\\u00e8re, Chamonix-Mont-Blanc, Bonneville, Haute-Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 74400, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [3.905872, 43.862148], "type": "Point"}, "properties": {"country": "France", "id": "en.42", "name": "Claret", "source": "nominatim", "sourceName": "Claret, Lod\\u00e8ve, H\\u00e9rault, Occitanie, France m\\u00e9tropolitaine, 34270, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [8.303371, 51.188893], "type": "Point"}, "properties": {"country": "Deutschland", "id": "en.46", "name": "Leisse", "source": "nominatim", "sourceName": "Lei\\u00dfe, Bad Fredeburg, Schmallenberg, Hochsauerlandkreis, Nordrhein-Westfalen, 57392, Deutschland", "type": "stream"}, "type": "Feature"}, {"geometry": {"coordinates": [6.147314, 46.219521], "type": "Point"}, "properties": {"country": "Schweiz/Suisse/Svizzera/Svizra", "id": "en.52", "name": "paquis", "source": "nominatim", "sourceName": "P\\u00e2quis, Gen\\u00e8ve, 1202, Schweiz/Suisse/Svizzera/Svizra", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [7.072597, 45.650494], "type": "Point"}, "properties": {"country": "Italia", "id": "en.57", "name": "Prariond", "source": "nominatim", "sourceName": "Prariond, Plant\\u00e9, Valgrisenche, Valle d\\u0027Aosta / Vall\\u00e9e d\\u0027Aoste, Italia", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [2.844478, 45.408958], "type": "Point"}, "properties": {"country": "France", "id": "en.62", "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, \\u00c9gliseneuve-d\\u0027Entraigues, Issoire, Puy-de-D\\u00f4me, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 63850, France", "type": "isolated_dwelling"}, "type": "Feature"}, {"geometry": {"coordinates": [2.844478, 45.408958], "type": "Point"}, "properties": {"country": "France", "id": "en.66", "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, \\u00c9gliseneuve-d\\u0027Entraigues, Issoire, Puy-de-D\\u00f4me, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 63850, France", "type": "isolated_dwelling"}, "type": "Feature"}, {"geometry": {"coordinates": [10.38635, 53.582329], "type": "Point"}, "properties": {"country": "Deutschland", "id": "en.72", "name": "Grande", "source": "nominatim", "sourceName": "Grande, Trittau, Stormarn, Schleswig-Holstein, Deutschland", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [8.303371, 51.188893], "type": "Point"}, "properties": {"country": "Deutschland", "id": "en.76", "name": "Leisse", "source": "nominatim", "sourceName": "Lei\\u00dfe, Bad Fredeburg, Schmallenberg, Hochsauerlandkreis, Nordrhein-Westfalen, 57392, Deutschland", "type": "stream"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"country": "France", "id": "en.82", "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"country": "France", "id": "en.86", "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [8.303371, 51.188893], "type": "Point"}, "properties": {"country": "Deutschland", "id": "en.90", "name": "Leisse", "source": "nominatim", "sourceName": "Lei\\u00dfe, Bad Fredeburg, Schmallenberg, Hochsauerlandkreis, Nordrhein-Westfalen, 57392, Deutschland", "type": "stream"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_7e7065bb4d17ca5707a88375cf728cfd.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2f2a2c880>" + ] + }, + "execution_count": 129, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc_geoparsed.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On voit clairement la différence par rapport au résultat précédent. Nous allons alors essayer de retrouver le même résultat en déroulant les différentes étapes pour désambiguïser avec `Perdido`.\n", + "\n", + "Pour gagner un peu de temps lors des prochaines executions nous allons faire directement appel à la fonction de geocoding à partir de la liste des noms de lieux.\n", + "\n", + "* Récuperer la liste des noms de lieux (sans doublon)" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Prariond', 'col', 'Fresse', 'berger', 'Leisse', 'Grassaz', 'Tichot', 'Nettes', 'Grande', 'GR', 'Grattaleu', 'Lognan', 'Plagne', 'Claret', 'Bellecote', 'Palet', 'paquis']\n" + ] + } + ], + "source": [ + "places_list = list(set([ent.text for ent in doc_geoparsed.ne_place]))\n", + "print(places_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### 6.3.1 Ajout d'un filtre \"code pays\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 137, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_8ae897deb5c0ea4cf86261ced0b8cd07 {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_8ae897deb5c0ea4cf86261ced0b8cd07" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_8ae897deb5c0ea4cf86261ced0b8cd07 = L.map(\n", + " "map_8ae897deb5c0ea4cf86261ced0b8cd07",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_15b583af933bb47d47ae15f191f85006 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_8ae897deb5c0ea4cf86261ced0b8cd07);\n", + " \n", + " \n", + "\n", + " function geo_json_cc248b50e49c3bf08c85030efc441ea3_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_cc248b50e49c3bf08c85030efc441ea3 = L.geoJson(null, {\n", + " onEachFeature: geo_json_cc248b50e49c3bf08c85030efc441ea3_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_cc248b50e49c3bf08c85030efc441ea3_add (data) {\n", + " geo_json_cc248b50e49c3bf08c85030efc441ea3\n", + " .addData(data)\n", + " .addTo(map_8ae897deb5c0ea4cf86261ced0b8cd07);\n", + " }\n", + " geo_json_cc248b50e49c3bf08c85030efc441ea3_add({"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "features": [{"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "geometry": {"coordinates": [[[6.839184, 45.480323], [6.83987, 45.479299], [6.841973, 45.478562], [6.843969, 45.47857], [6.845235, 45.479931], [6.847187, 45.479675], [6.847766, 45.480112], [6.848368, 45.479932], [6.849569, 45.480172], [6.850213, 45.479029], [6.850685, 45.477254], [6.8509, 45.476306], [6.851114, 45.474425], [6.851758, 45.472889], [6.853217, 45.471626], [6.855106, 45.46982], [6.855534, 45.468766], [6.855191, 45.468014], [6.85605, 45.46684], [6.856092, 45.464914], [6.856049, 45.463891], [6.855663, 45.462356], [6.856093, 45.461679], [6.856822, 45.46137], [6.857122, 45.460038], [6.857166, 45.458864], [6.857724, 45.458021], [6.858754, 45.457765], [6.859698, 45.458503], [6.860513, 45.458097], [6.861564, 45.458676], [6.861575, 45.457732], [6.860641, 45.456396], [6.864246, 45.456245], [6.865748, 45.455944], [6.867508, 45.455763], [6.869139, 45.455884], [6.870942, 45.456034], [6.875319, 45.454649], [6.879224, 45.455432], [6.881391, 45.454996], [6.883816, 45.455463], [6.886091, 45.455613], [6.887936, 45.456004], [6.890725, 45.457841], [6.890789, 45.45608], [6.891379, 45.454687], [6.892742, 45.454379], [6.894287, 45.453084], [6.896261, 45.45191], [6.896733, 45.452663], [6.898192, 45.452602], [6.899759, 45.453009], [6.90184, 45.452392], [6.902398, 45.451308], [6.903771, 45.450827], [6.905102, 45.450525], [6.906303, 45.451308], [6.909179, 45.449742], [6.911582, 45.448568], [6.913986, 45.447755], [6.916839, 45.44619], [6.917944, 45.444971], [6.920036, 45.444083], [6.92214, 45.441493], [6.921732, 45.440138], [6.91921, 45.437713], [6.916174, 45.435741], [6.915831, 45.433859], [6.915701, 45.432067], [6.914092, 45.430877], [6.912398, 45.429567], [6.912054, 45.428845], [6.910767, 45.428423], [6.910209, 45.4277], [6.910423, 45.427038], [6.908664, 45.425321], [6.906861, 45.423603], [6.905509, 45.42261], [6.903985, 45.421586], [6.904544, 45.420486], [6.904587, 45.418784], [6.903986, 45.41779], [6.9039, 45.416254], [6.904393, 45.414838], [6.9042, 45.413301], [6.902741, 45.411855], [6.90081, 45.411524], [6.900123, 45.410636], [6.90111, 45.409476], [6.901003, 45.408707], [6.900349, 45.408564], [6.900064, 45.409095], [6.899343, 45.408773], [6.89742, 45.408511], [6.893514, 45.404624], [6.890639, 45.403811], [6.889116, 45.403374], [6.887592, 45.402576], [6.886176, 45.401822], [6.886262, 45.400858], [6.886444, 45.400128], [6.887142, 45.4], [6.88652, 45.399201], [6.885339, 45.398297], [6.885704, 45.397966], [6.88403, 45.397318], [6.88227, 45.396851]]], "type": "MultiLineString"}, "id": "0", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " map_8ae897deb5c0ea4cf86261ced0b8cd07.fitBounds(\n", + " [[43.157123, -1.244805], [50.823249, 7.211431]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_460c04e1cc847389755455850b2d7ae1_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_460c04e1cc847389755455850b2d7ae1 = L.geoJson(null, {\n", + " onEachFeature: geo_json_460c04e1cc847389755455850b2d7ae1_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_460c04e1cc847389755455850b2d7ae1_add (data) {\n", + " geo_json_460c04e1cc847389755455850b2d7ae1\n", + " .addData(data)\n", + " .addTo(map_8ae897deb5c0ea4cf86261ced0b8cd07);\n", + " }\n", + " geo_json_460c04e1cc847389755455850b2d7ae1_add({"features": [{"geometry": {"coordinates": [6.43923, 45.445076], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Prariond", "source": "nominatim", "sourceName": "Prariond, Mottet, Les Avanchers-Valmorel, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73260, France", "type": "platter"}, "type": "Feature"}, {"geometry": {"coordinates": [4.467755, 44.831458], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "col", "source": "nominatim", "sourceName": "Col, Saint-Pierreville, Tournon-sur-Rh\\u00f4ne, Ard\\u00e8che, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 07190, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [2.844478, 45.408958], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, \\u00c9gliseneuve-d\\u0027Entraigues, Issoire, Puy-de-D\\u00f4me, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 63850, France", "type": "isolated_dwelling"}, "type": "Feature"}, {"geometry": {"coordinates": [5.060961, 46.105022], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "berger", "source": "nominatim", "sourceName": "Berger, Saint-Andr\\u00e9-le-Bouchoux, Bourg-en-Bresse, Ain, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 01240, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.837532, 45.456069], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Grassaz", "source": "nominatim", "sourceName": "Col de la Grassaz, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [6.896874, 45.454039], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Tichot", "source": "nominatim", "sourceName": "Tichot, Tarte \\u00e0 Lognan, Val-Claret, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [3.682996, 44.905336], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Grande", "source": "nominatim", "sourceName": "Grande, Alleyras, Le Puy-en-Velay, Haute-Loire, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 43580, France", "type": "residential"}, "type": "Feature"}, {"geometry": {"coordinates": [2.014202, 50.823249], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "GR", "source": "nominatim", "sourceName": "Grande Rue, Louches, Calais, Pas-de-Calais, Hauts-de-France, France m\\u00e9tropolitaine, 62610, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.926505, 45.978552], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Lognan", "source": "nominatim", "sourceName": "Lognan, Chemin de la Glaci\\u00e8re, Les Chosalets, Argenti\\u00e8re, Chamonix-Mont-Blanc, Bonneville, Haute-Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 74400, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [1.060214, 43.157123], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Plagne", "source": "nominatim", "sourceName": "Plagne, Muret, Haute-Garonne, Occitanie, France m\\u00e9tropolitaine, 31220, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [3.905872, 43.862148], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Claret", "source": "nominatim", "sourceName": "Claret, Lod\\u00e8ve, H\\u00e9rault, Occitanie, France m\\u00e9tropolitaine, 34270, France", "type": "administrative"}, "type": "Feature"}, {"geometry": {"coordinates": [6.963285, 45.462018], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Bellecote", "source": "nominatim", "sourceName": "Bellecote, Sentier de la Vall\\u00e9e Perdue, Le Cr\\u00eat, La Daille, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [-1.244805, 48.200191], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Palet", "source": "nominatim", "sourceName": "Palet, Taillis, Foug\\u00e8res-Vitr\\u00e9, Ille-et-Vilaine, Bretagne, France m\\u00e9tropolitaine, 35500, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [7.211431, 48.207614], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "paquis", "source": "nominatim", "sourceName": "Paquis, Aubure, Colmar-Ribeauvill\\u00e9, Haut-Rhin, Grand Est, France m\\u00e9tropolitaine, 68150, France", "type": "locality"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_460c04e1cc847389755455850b2d7ae1.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2f5e69fd0>" + ] + }, + "execution_count": 137, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# instancier le geocoder avec le code pays\n", + "geocoder = Geocoder(country_code = 'fr')\n", + "doc_geocoded = geocoder(places_list)\n", + "\n", + "# ajouter la trace GPS \n", + "doc_geocoded.geometry_layer = doc.geometry_layer\n", + "\n", + "doc_geocoded.get_folium_map()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### 6.3.2 Ajout d'un filtre \"bounding box\"" + ] + }, + { + "cell_type": "code", + "execution_count": 140, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_35b6ec2c5ddc6a2a0c2dbc58974d252f {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_35b6ec2c5ddc6a2a0c2dbc58974d252f" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_35b6ec2c5ddc6a2a0c2dbc58974d252f = L.map(\n", + " "map_35b6ec2c5ddc6a2a0c2dbc58974d252f",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_f9ad6977b3a945af9274ce7c0b721078 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_35b6ec2c5ddc6a2a0c2dbc58974d252f);\n", + " \n", + " \n", + "\n", + " function geo_json_ebc8c86364c56973a4794e370e29036c_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_ebc8c86364c56973a4794e370e29036c = L.geoJson(null, {\n", + " onEachFeature: geo_json_ebc8c86364c56973a4794e370e29036c_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_ebc8c86364c56973a4794e370e29036c_add (data) {\n", + " geo_json_ebc8c86364c56973a4794e370e29036c\n", + " .addData(data)\n", + " .addTo(map_35b6ec2c5ddc6a2a0c2dbc58974d252f);\n", + " }\n", + " geo_json_ebc8c86364c56973a4794e370e29036c_add({"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "features": [{"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "geometry": {"coordinates": [[[6.839184, 45.480323], [6.83987, 45.479299], [6.841973, 45.478562], [6.843969, 45.47857], [6.845235, 45.479931], [6.847187, 45.479675], [6.847766, 45.480112], [6.848368, 45.479932], [6.849569, 45.480172], [6.850213, 45.479029], [6.850685, 45.477254], [6.8509, 45.476306], [6.851114, 45.474425], [6.851758, 45.472889], [6.853217, 45.471626], [6.855106, 45.46982], [6.855534, 45.468766], [6.855191, 45.468014], [6.85605, 45.46684], [6.856092, 45.464914], [6.856049, 45.463891], [6.855663, 45.462356], [6.856093, 45.461679], [6.856822, 45.46137], [6.857122, 45.460038], [6.857166, 45.458864], [6.857724, 45.458021], [6.858754, 45.457765], [6.859698, 45.458503], [6.860513, 45.458097], [6.861564, 45.458676], [6.861575, 45.457732], [6.860641, 45.456396], [6.864246, 45.456245], [6.865748, 45.455944], [6.867508, 45.455763], [6.869139, 45.455884], [6.870942, 45.456034], [6.875319, 45.454649], [6.879224, 45.455432], [6.881391, 45.454996], [6.883816, 45.455463], [6.886091, 45.455613], [6.887936, 45.456004], [6.890725, 45.457841], [6.890789, 45.45608], [6.891379, 45.454687], [6.892742, 45.454379], [6.894287, 45.453084], [6.896261, 45.45191], [6.896733, 45.452663], [6.898192, 45.452602], [6.899759, 45.453009], [6.90184, 45.452392], [6.902398, 45.451308], [6.903771, 45.450827], [6.905102, 45.450525], [6.906303, 45.451308], [6.909179, 45.449742], [6.911582, 45.448568], [6.913986, 45.447755], [6.916839, 45.44619], [6.917944, 45.444971], [6.920036, 45.444083], [6.92214, 45.441493], [6.921732, 45.440138], [6.91921, 45.437713], [6.916174, 45.435741], [6.915831, 45.433859], [6.915701, 45.432067], [6.914092, 45.430877], [6.912398, 45.429567], [6.912054, 45.428845], [6.910767, 45.428423], [6.910209, 45.4277], [6.910423, 45.427038], [6.908664, 45.425321], [6.906861, 45.423603], [6.905509, 45.42261], [6.903985, 45.421586], [6.904544, 45.420486], [6.904587, 45.418784], [6.903986, 45.41779], [6.9039, 45.416254], [6.904393, 45.414838], [6.9042, 45.413301], [6.902741, 45.411855], [6.90081, 45.411524], [6.900123, 45.410636], [6.90111, 45.409476], [6.901003, 45.408707], [6.900349, 45.408564], [6.900064, 45.409095], [6.899343, 45.408773], [6.89742, 45.408511], [6.893514, 45.404624], [6.890639, 45.403811], [6.889116, 45.403374], [6.887592, 45.402576], [6.886176, 45.401822], [6.886262, 45.400858], [6.886444, 45.400128], [6.887142, 45.4], [6.88652, 45.399201], [6.885339, 45.398297], [6.885704, 45.397966], [6.88403, 45.397318], [6.88227, 45.396851]]], "type": "MultiLineString"}, "id": "0", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " map_35b6ec2c5ddc6a2a0c2dbc58974d252f.fitBounds(\n", + " [[45.207191, 5.867346], [45.462018, 6.963285]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_fb57b35f8d16bd07d4991ba94440c58c_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_fb57b35f8d16bd07d4991ba94440c58c = L.geoJson(null, {\n", + " onEachFeature: geo_json_fb57b35f8d16bd07d4991ba94440c58c_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_fb57b35f8d16bd07d4991ba94440c58c_add (data) {\n", + " geo_json_fb57b35f8d16bd07d4991ba94440c58c\n", + " .addData(data)\n", + " .addTo(map_35b6ec2c5ddc6a2a0c2dbc58974d252f);\n", + " }\n", + " geo_json_fb57b35f8d16bd07d4991ba94440c58c_add({"features": [{"geometry": {"coordinates": [6.43923, 45.445076], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Prariond", "source": "nominatim", "sourceName": "Prariond, Mottet, Les Avanchers-Valmorel, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73260, France", "type": "platter"}, "type": "Feature"}, {"geometry": {"coordinates": [6.60536, 45.273046], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "col", "source": "nominatim", "sourceName": "Col, Boulevard Lauzes, Slalom, Saint-Martin-de-Belleville, Les Belleville, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73440, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.92583, 45.442088], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, Piste du Col de Fresse, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [5.867346, 45.308667], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "berger", "source": "nominatim", "sourceName": "Berger, Saint-Hilaire, Plateau-des-Petites-Roches, Grenoble, Is\\u00e8re, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 38660, France", "type": "footway"}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.837532, 45.456069], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Grassaz", "source": "nominatim", "sourceName": "Col de la Grassaz, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [6.896874, 45.454039], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Tichot", "source": "nominatim", "sourceName": "Tichot, Tarte \\u00e0 Lognan, Val-Claret, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "type": "station"}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.579058, 45.298166], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "GR", "source": "nominatim", "sourceName": "Grande Rue, Saint-Martin-de-Belleville, Les Belleville, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73440, France", "type": "quarter"}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "type": "water"}, "type": "Feature"}, {"geometry": {"coordinates": [6.395829, 45.350595], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Lognan", "source": "nominatim", "sourceName": "Cr\\u00eat Lognan, Les Belleville, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, France", "type": "peak"}, "type": "Feature"}, {"geometry": {"coordinates": [6.392506, 45.207191], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Plagne", "source": "nominatim", "sourceName": "Plagne, Copies, La Plagne, Albanne, Montricher-Albanne, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73870, France", "type": "platter"}, "type": "Feature"}, {"geometry": {"coordinates": [6.422623, 45.255481], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Claret", "source": "nominatim", "sourceName": "Claret, Saint-Julien-Mont-Denis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73870, France", "type": "hamlet"}, "type": "Feature"}, {"geometry": {"coordinates": [6.963285, 45.462018], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Bellecote", "source": "nominatim", "sourceName": "Bellecote, Sentier de la Vall\\u00e9e Perdue, Le Cr\\u00eat, La Daille, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "type": "yes"}, "type": "Feature"}, {"geometry": {"coordinates": [6.863067, 45.451642], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "Palet", "source": "nominatim", "sourceName": "Signal du Palet, Champagny-en-Vanoise, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73350, France", "type": "peak"}, "type": "Feature"}, {"geometry": {"coordinates": [6.914334, 45.458216], "type": "Point"}, "properties": {"country": "France", "id": 0, "name": "paquis", "source": "nominatim", "sourceName": "Paquis, GunPowder, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "type": "station"}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_fb57b35f8d16bd07d4991ba94440c58c.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2f2a2cf70>" + ] + }, + "execution_count": 140, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "Délimiter un zone restreinte lors de la requête\n", + "bbox = [5.62216508714297, 45.051683489057, 7.18563279407213, 45.9384576816403] # zone d'intervention du PGHM Isère\n", "\n", - "Premier niveau : utilisation d'un code pays." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Deuxième niveau : utilisation d'une bounding box délimitant la zone de recherche" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Désambiguisation basé sur la proximité géographique\n", + "# instancier le geocoder avec le code pays et une bounding box\n", + "geocoder = Geocoder(country_code = 'fr', bbox = bbox)\n", + "doc_geocoded = geocoder(places_list)\n", "\n", - "Clustering avec la méthode DBSCAN. Cette stratégie est adaptée pour une description d'itinéraire où les différents lieux cités doivent être localisés à proximité les uns des autres." + "# ajouter la trace GPS \n", + "doc_geocoded.geometry_layer = doc.geometry_layer\n", + "\n", + "# affiche la carte\n", + "doc_geocoded.get_folium_map()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "#### Résultats avant désambiguisation" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "d['data'][1].get_folium_map()" + "#### 6.3.3 Clustering par densité spatiale" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 141, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", + "<head> \n", + " <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", + " \n", + " <script>\n", + " L_NO_TOUCH = false;\n", + " L_DISABLE_3D = false;\n", + " </script>\n", + " \n", + " <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", + " <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", + " <script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>\n", + " <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>\n", + " <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>\n", + " <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>\n", + " <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>\n", + " <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", + " <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", + " \n", + " <meta name="viewport" content="width=device-width,\n", + " initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", + " <style>\n", + " #map_fe2cfa179d84b5e254153f369ebe752f {\n", + " position: relative;\n", + " width: 100.0%;\n", + " height: 100.0%;\n", + " left: 0.0%;\n", + " top: 0.0%;\n", + " }\n", + " </style>\n", + " \n", + " \n", + " <style>\n", + " .foliumtooltip {\n", + " \n", + " }\n", + " .foliumtooltip table{\n", + " margin: auto;\n", + " }\n", + " .foliumtooltip tr{\n", + " text-align: left;\n", + " }\n", + " .foliumtooltip th{\n", + " padding: 2px; padding-right: 8px;\n", + " }\n", + " </style>\n", + " \n", + "</head>\n", + "<body> \n", + " \n", + " <div class="folium-map" id="map_fe2cfa179d84b5e254153f369ebe752f" ></div>\n", + " \n", + "</body>\n", + "<script> \n", + " \n", + " var map_fe2cfa179d84b5e254153f369ebe752f = L.map(\n", + " "map_fe2cfa179d84b5e254153f369ebe752f",\n", + " {\n", + " center: [0, 0],\n", + " crs: L.CRS.EPSG3857,\n", + " zoom: 1,\n", + " zoomControl: true,\n", + " preferCanvas: false,\n", + " }\n", + " );\n", + "\n", + " \n", + "\n", + " \n", + " \n", + " var tile_layer_67f56a2e2a71291a8a3789435daae069 = L.tileLayer(\n", + " "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",\n", + " {"attribution": "Data by \\u0026copy; \\u003ca href=\\"http://openstreetmap.org\\"\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca href=\\"http://www.openstreetmap.org/copyright\\"\\u003eODbL\\u003c/a\\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}\n", + " ).addTo(map_fe2cfa179d84b5e254153f369ebe752f);\n", + " \n", + " \n", + "\n", + " function geo_json_926132e84a8700abc9f52e3b79d1902e_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_926132e84a8700abc9f52e3b79d1902e = L.geoJson(null, {\n", + " onEachFeature: geo_json_926132e84a8700abc9f52e3b79d1902e_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_926132e84a8700abc9f52e3b79d1902e_add (data) {\n", + " geo_json_926132e84a8700abc9f52e3b79d1902e\n", + " .addData(data)\n", + " .addTo(map_fe2cfa179d84b5e254153f369ebe752f);\n", + " }\n", + " geo_json_926132e84a8700abc9f52e3b79d1902e_add({"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "features": [{"bbox": [6.839184, 45.396851, 6.92214, 45.480323], "geometry": {"coordinates": [[[6.839184, 45.480323], [6.83987, 45.479299], [6.841973, 45.478562], [6.843969, 45.47857], [6.845235, 45.479931], [6.847187, 45.479675], [6.847766, 45.480112], [6.848368, 45.479932], [6.849569, 45.480172], [6.850213, 45.479029], [6.850685, 45.477254], [6.8509, 45.476306], [6.851114, 45.474425], [6.851758, 45.472889], [6.853217, 45.471626], [6.855106, 45.46982], [6.855534, 45.468766], [6.855191, 45.468014], [6.85605, 45.46684], [6.856092, 45.464914], [6.856049, 45.463891], [6.855663, 45.462356], [6.856093, 45.461679], [6.856822, 45.46137], [6.857122, 45.460038], [6.857166, 45.458864], [6.857724, 45.458021], [6.858754, 45.457765], [6.859698, 45.458503], [6.860513, 45.458097], [6.861564, 45.458676], [6.861575, 45.457732], [6.860641, 45.456396], [6.864246, 45.456245], [6.865748, 45.455944], [6.867508, 45.455763], [6.869139, 45.455884], [6.870942, 45.456034], [6.875319, 45.454649], [6.879224, 45.455432], [6.881391, 45.454996], [6.883816, 45.455463], [6.886091, 45.455613], [6.887936, 45.456004], [6.890725, 45.457841], [6.890789, 45.45608], [6.891379, 45.454687], [6.892742, 45.454379], [6.894287, 45.453084], [6.896261, 45.45191], [6.896733, 45.452663], [6.898192, 45.452602], [6.899759, 45.453009], [6.90184, 45.452392], [6.902398, 45.451308], [6.903771, 45.450827], [6.905102, 45.450525], [6.906303, 45.451308], [6.909179, 45.449742], [6.911582, 45.448568], [6.913986, 45.447755], [6.916839, 45.44619], [6.917944, 45.444971], [6.920036, 45.444083], [6.92214, 45.441493], [6.921732, 45.440138], [6.91921, 45.437713], [6.916174, 45.435741], [6.915831, 45.433859], [6.915701, 45.432067], [6.914092, 45.430877], [6.912398, 45.429567], [6.912054, 45.428845], [6.910767, 45.428423], [6.910209, 45.4277], [6.910423, 45.427038], [6.908664, 45.425321], [6.906861, 45.423603], [6.905509, 45.42261], [6.903985, 45.421586], [6.904544, 45.420486], [6.904587, 45.418784], [6.903986, 45.41779], [6.9039, 45.416254], [6.904393, 45.414838], [6.9042, 45.413301], [6.902741, 45.411855], [6.90081, 45.411524], [6.900123, 45.410636], [6.90111, 45.409476], [6.901003, 45.408707], [6.900349, 45.408564], [6.900064, 45.409095], [6.899343, 45.408773], [6.89742, 45.408511], [6.893514, 45.404624], [6.890639, 45.403811], [6.889116, 45.403374], [6.887592, 45.402576], [6.886176, 45.401822], [6.886262, 45.400858], [6.886444, 45.400128], [6.887142, 45.4], [6.88652, 45.399201], [6.885339, 45.398297], [6.885704, 45.397966], [6.88403, 45.397318], [6.88227, 45.396851]]], "type": "MultiLineString"}, "id": "0", "properties": {}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " map_fe2cfa179d84b5e254153f369ebe752f.fitBounds(\n", + " [[45.412971, 6.837532], [45.462018, 6.963285]],\n", + " {}\n", + " );\n", + " \n", + " \n", + "\n", + " function geo_json_4b64839f8529cbdc6738c611d105d767_onEachFeature(feature, layer) {\n", + " layer.on({\n", + " });\n", + " };\n", + " var geo_json_4b64839f8529cbdc6738c611d105d767 = L.geoJson(null, {\n", + " onEachFeature: geo_json_4b64839f8529cbdc6738c611d105d767_onEachFeature,\n", + " \n", + " });\n", + "\n", + " function geo_json_4b64839f8529cbdc6738c611d105d767_add (data) {\n", + " geo_json_4b64839f8529cbdc6738c611d105d767\n", + " .addData(data)\n", + " .addTo(map_fe2cfa179d84b5e254153f369ebe752f);\n", + " }\n", + " geo_json_4b64839f8529cbdc6738c611d105d767_add({"features": [{"geometry": {"coordinates": [6.92583, 45.442088], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.442088, "longitude": 6.92583, "name": "Fresse", "source": "nominatim", "sourceName": "Fresse, Piste du Col de Fresse, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.898275, 45.419228], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.419228, "longitude": 6.898275, "name": "Leisse", "source": "nominatim", "sourceName": "Leisse, Chemin de Borsat, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.837532, 45.456069], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.456069, "longitude": 6.837532, "name": "Grassaz", "source": "nominatim", "sourceName": "Col de la Grassaz, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.896874, 45.454039], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.454039, "longitude": 6.896874, "name": "Tichot", "source": "nominatim", "sourceName": "Tichot, Tarte \\u00e0 Lognan, Val-Claret, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.89952, 45.412971], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.412971, "longitude": 6.89952, "name": "Nettes", "source": "nominatim", "sourceName": "Lac des Nettes, Termignon, Val-Cenis, Saint-Jean-de-Maurienne, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73500, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.858926, 45.461481], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.461481, "longitude": 6.858926, "name": "Grattaleu", "source": "nominatim", "sourceName": "Lac du Grattaleu, Peisey-Nancroix, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73210, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.963285, 45.462018], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.462018, "longitude": 6.963285, "name": "Bellecote", "source": "nominatim", "sourceName": "Bellecote, Sentier de la Vall\\u00e9e Perdue, Le Cr\\u00eat, La Daille, Val-d\\u0027Is\\u00e8re, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73150, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.863067, 45.451642], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.451642, "longitude": 6.863067, "name": "Palet", "source": "nominatim", "sourceName": "Signal du Palet, Champagny-en-Vanoise, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73350, France", "xmlID": 0}, "type": "Feature"}, {"geometry": {"coordinates": [6.914334, 45.458216], "type": "Point"}, "properties": {"cluster": 0, "country": "France", "latitude": 45.458216, "longitude": 6.914334, "name": "paquis", "source": "nominatim", "sourceName": "Paquis, GunPowder, Tignes, Albertville, Savoie, Auvergne-Rh\\u00f4ne-Alpes, France m\\u00e9tropolitaine, 73320, France", "xmlID": 0}, "type": "Feature"}], "type": "FeatureCollection"});\n", + "\n", + " \n", + " \n", + " geo_json_4b64839f8529cbdc6738c611d105d767.bindTooltip(\n", + " function(layer){\n", + " let div = L.DomUtil.create('div');\n", + " \n", + " let handleObject = feature=>typeof(feature)=='object' ? JSON.stringify(feature) : feature;\n", + " let fields = ["name", "source"];\n", + " let aliases = ["name", "source"];\n", + " let table = '<table>' +\n", + " String(\n", + " fields.map(\n", + " (v,i)=>\n", + " `<tr>\n", + " <th>${aliases[i].toLocaleString()}</th>\n", + " \n", + " <td>${handleObject(layer.feature.properties[v]).toLocaleString()}</td>\n", + " </tr>`).join(''))\n", + " +'</table>';\n", + " div.innerHTML=table;\n", + " \n", + " return div\n", + " }\n", + " ,{"className": "foliumtooltip", "sticky": true});\n", + " \n", + "</script>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" + ], + "text/plain": [ + "<folium.folium.Map at 0x2f1e1cd00>" + ] + }, + "execution_count": 141, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "d['data'][1].cluster_disambiguation()" + "# appliquer la désambiguïsation \n", + "doc_geocoded.cluster_disambiguation()\n", + "doc_geocoded.get_folium_map()" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "d['data'][1].get_folium_map()" + "Désambiguisation basé sur la proximité géographique\n", + "\n", + "Clustering avec la méthode DBSCAN implémenté dans la librairie [Scikit-Learn](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html). Cette stratégie est adaptée pour une description d'itinéraire où les différents lieux cités doivent être localisés à proximité les uns des autres." ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, "source": [ "Utilisation du contexte (autres entités nommées repérées dans le texte, relations spatiales, etc...). Développées dans le cadre du projet [Perdido]() (add ref 2014 et 2016) mais pas encore intégré à la librairie Python Perdido. Cette librairie est toujours en cours de développement et d'amélioration. Vos remarques et retours seront les bienvenues." ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {