Skip to content

Instantly share code, notes, and snippets.

@joker234
Last active July 27, 2020 14:59
Show Gist options
  • Save joker234/54069f1d54da6cd31fd6f20774058883 to your computer and use it in GitHub Desktop.
Save joker234/54069f1d54da6cd31fd6f20774058883 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import folium\n",
"import openrouteservice as ors\n",
"from geojson import FeatureCollection, Feature, Polygon"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def create_user_weights(geometries, weights):\n",
" features = []\n",
" for geometry, weight in zip(geometries, weights):\n",
" features.append(Feature(geometry=geometry, properties={\"weight\": weight}))\n",
" return FeatureCollection(features)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"coords = [[8.676581, 49.418204], [8.692803, 49.409465]]\n",
"host = \"http://localhost:8082/ors\"\n",
"profile = 'foot-walking'\n",
"format = 'json'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"user_weights_list = []\n",
"for weight_change in [-0.9, -0.4, 0.0, +4.1]:\n",
" geometries = [Polygon([[[8.691, 49.415], [8.691, 49.413], [8.699, 49.413],\n",
" [8.691, 49.415]]])]\n",
" weights = [1.0]\n",
" weights = [x + weight_change for x in weights]\n",
" user_weights_list.append(create_user_weights(geometries, weights))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"responses = []\n",
"for user_weights in user_weights_list:\n",
" client = ors.Client(base_url=host)\n",
" resp = client.request(\n",
" url=f'/v2/directions/{profile}/{format}',\n",
" get_params={},\n",
" post_json={\n",
" 'coordinates': coords,\n",
" 'user_weights': user_weights\n",
" })\n",
" responses.append(resp)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0: weight: 0.10, color: black\n",
"1: weight: 0.60, color: red\n",
"2: weight: 1.00, color: green\n",
"3: weight: 5.10, color: blue\n"
]
},
{
"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 src=\"about:blank\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" data-html=PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgCiAgICAgICAgPHNjcmlwdD4KICAgICAgICAgICAgTF9OT19UT1VDSCA9IGZhbHNlOwogICAgICAgICAgICBMX0RJU0FCTEVfM0QgPSBmYWxzZTsKICAgICAgICA8L3NjcmlwdD4KICAgIAogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vbGVhZmxldEAxLjYuMC9kaXN0L2xlYWZsZXQuanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY29kZS5qcXVlcnkuY29tL2pxdWVyeS0xLjEyLjQubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9qcy9ib290c3RyYXAubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9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gICAgICAgICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwKICAgICAgICAgICAgICAgIGluaXRpYWwtc2NhbGU9MS4wLCBtYXhpbXVtLXNjYWxlPTEuMCwgdXNlci1zY2FsYWJsZT1ubyIgLz4KICAgICAgICAgICAgPHN0eWxlPgogICAgICAgICAgICAgICAgI21hcF80MDM2Njg2MmE2YWY0OWVjODM0MWRkYTVjZDY4YzcwOCB7CiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwogICAgICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAuMCU7CiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAxMDAuMCU7CiAgICAgICAgICAgICAgICAgICAgbGVmdDogMC4wJTsKICAgICAgICAgICAgICAgICAgICB0b3A6IDAuMCU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIDwvc3R5bGU+CiAgICAgICAgCjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICAgICAgICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfNDAzNjY4NjJhNmFmNDllYzgzNDFkZGE1Y2Q2OGM3MDgiID48L2Rpdj4KICAgICAgICAKPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgICAgICAgICB2YXIgbWFwXzQwMzY2ODYyYTZhZjQ5ZWM4MzQxZGRhNWNkNjhjNzA4ID0gTC5tYXAoCiAgICAgICAgICAgICAgICAibWFwXzQwMzY2ODYyYTZhZjQ5ZWM4MzQxZGRhNWNkNjhjNzA4IiwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBjZW50ZXI6IFs0OS40MTIsIDguNjgxXSwKICAgICAgICAgICAgICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3LAogICAgICAgICAgICAgICAgICAgIHpvb206IDE1LAogICAgICAgICAgICAgICAgICAgIHpvb21Db250cm9sOiB0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UxZjAxZF9hZGQoeyJmZWF0dXJlcyI6IFt7Imdlb21ldHJ5IjogeyJjb29yZGluYXRlcyI6IFtbWzguNjkxLCA0OS40MTVdLCBbOC42OTEsIDQ5LjQxM10sIFs4LjY5OSwgNDkuNDEzXSwgWzguNjkxLCA0OS40MTVdXV0sICJ0eXBlIjogIlBvbHlnb24ifSwgImlkIjogMCwgInByb3BlcnRpZXMiOiB7IndlaWdodCI6IDAuMDk5OTk5OTk5OTk5OTk5OTh9LCAidHlwZSI6ICJGZWF0dXJlIn1dLCAidHlwZSI6ICJGZWF0dXJlQ29sbGVjdGlvbiJ9KTsKICAgICAgICAKICAgIAogICAgICAgIGZ1bmN0aW9uIGdlb19qc29uXzZmZGIzZGNjZGQzMDQwZDdhNTJiOGZlN2MxNGViMjZjX3N0eWxlcihmZWF0dXJlKSB7CiAgICAgICAgICAgIHN3aXRjaChmZWF0dXJlLmlkKSB7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIHJldHVybiB7ImNvbG9yIjogImJsYWNrIn07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gZ2VvX2pzb25fNmZkYjNkY2NkZDMwNDBkN2E1MmI4ZmU3YzE0ZWIyNmNfb25FYWNoRmVhdHVyZShmZWF0dXJlLCBsYXllcikgewogICAgICAgICAgICBsYXllci5vbih7CiAgICAgICAgICAgICAgICBjbGljazogZnVuY3Rpb24oZSkgewogICAgICAgICAgICAgICAgICAgIG1hcF80MDM2Njg2MmE2YWY0OWVjODM0MWRkYTVjZDY4YzcwOC5maXRCb3VuZHMoZS50YXJnZXQuZ2V0Qm91bmRzKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIHZhciBnZW9fanNvbl82ZmRiM2RjY2RkMzA0MGQ3YTUyYjhmZTdjMTRlYjI2YyA9IEwuZ2VvSnNvbihudWxsLCB7CiAgICAgICAgICAgICAgICBv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gICBgPGRpdj4KICAgICAgICAgICAgICAgICAgICAgMS4wMAogICAgICAgICAgICAgICAgIDwvZGl2PmAsCiAgICAgICAgICAgICAgICB7InN0aWNreSI6IHRydWV9CiAgICAgICAgICAgICk7CiAgICAgICAgCiAgICAKICAgICAgICBmdW5jdGlvbiBnZW9fanNvbl9lYzc3OTMzODBkN2Q0Mzk3YWVhMzcwMjlhNDczMTYzZV9zdHlsZXIoZmVhdHVyZSkgewogICAgICAgICAgICBzd2l0Y2goZmVhdHVyZS5pZCkgewogICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICByZXR1cm4geyJjb2xvciI6ICJibHVlIn07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gZ2VvX2pzb25fZWM3NzkzMzgwZDdkNDM5N2FlYTM3MDI5YTQ3MzE2M2Vfb25FYWNoRmVhdHVyZShmZWF0dXJlLCBsYXllcikgewogICAgICAgICAgICBsYXllci5vbih7CiAgICAgICAgICAgICAgICBjbGljazogZnVuY3Rpb24oZSkgewogICAgICAgICAgICAgICAgICAgIG1hcF80MDM2Njg2MmE2YWY0OWVjODM0MWRkYTVjZDY4YzcwOC5maXRCb3VuZHMoZS50YXJnZXQuZ2V0Qm91bmRzKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIHZhciBnZW9fanNvbl9lYzc3OTMzODBkN2Q0Mzk3YWVhMzcwMjlhNDczMTYzZSA9IEwuZ2VvSnNvbihudWxsLCB7CiAgICAgICAgICAgICAgICBvbkVhY2hGZWF0dXJlOiBnZW9fanNvbl9lYzc3OTMzODBkN2Q0Mzk3YWVhMzcwMjlhNDczMTYzZV9vbkVhY2hGZWF0dXJlLAogICAgICAgICAgICAKICAgICAgICAgICAgICAgIHN0eWxlOiBnZW9fanNvbl9lYzc3OTMzODBkN2Q0Mzk3YWVhMzcwMjlhNDczMTYzZV9zdHlsZXIsCiAgICAgIC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jkxMTQsIDQ5LjQwOTk5XSwgWzguNjkxMjEsIDQ5LjQxXSwgWzguNjkxNjgsIDQ5LjQxMDA4XSwgWzguNjkxNzIsIDQ5LjQxMDA5XSwgWzguNjkyMzgsIDQ5LjQxMDIzXSwgWzguNjkyNDUsIDQ5LjQxMDI1XSwgWzguNjkyNzEsIDQ5LjQwOTgxXSwgWzguNjkyNzMsIDQ5LjQwOTc2XSwgWzguNjkyNzYsIDQ5LjQwOTY3XSwgWzguNjkyNzgsIDQ5LjQwOTYxXSwgWzguNjkyNzgsIDQ5LjQwOTU1XSwgWzguNjkyNzYsIDQ5LjQwOTQ5XSwgWzguNjkyNzUsIDQ5LjQwOTQ3XV0sICJ0eXBlIjogIkxpbmVTdHJpbmcifSwgImlkIjogMywgInR5cGUiOiAiRmVhdHVyZSJ9XSwgInR5cGUiOiAiRmVhdHVyZUNvbGxlY3Rpb24ifSk7CiAgICAgICAgCiAgICAKICAgICAgICAgICAgZ2VvX2pzb25fZmQxMjMxOGJmODkxNDJlNTgzMDgzMDcwNTkxNzk4NWIuYmluZFRvb2x0aXAoCiAgICAgICAgICAgICAgICBgPGRpdj4KICAgICAgICAgICAgICAgICAgICAgNS4xMAogICAgICAgICAgICAgICAgIDwvZGl2PmAsCiAgICAgICAgICAgICAgICB7InN0aWNreSI6IHRydWV9CiAgICAgICAgICAgICk7CiAgICAgICAgCjwvc2NyaXB0Pg== onload=\"this.contentDocument.open();this.contentDocument.write(atob(this.getAttribute('data-html')));this.contentDocument.close();\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f72f8f651c0>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = folium.Map(location=[49.412,8.681], zoom_start=15)\n",
"colors = ['black', 'red', 'green', 'blue']\n",
"for i, (response, user_weights) in enumerate(zip(responses, user_weights_list)):\n",
" weight = response['metadata']['query']['user_weights']['features'][0]['properties']['weight']\n",
" print('{}: weight: {:.2f}, color: {}'.format(i, weight, colors[i]))\n",
" result_geometry = ors.convert.decode_polyline(response['routes'][0]['geometry'])\n",
" geoJSON_input = {'type': 'Feature', 'id': i, 'geometry': result_geometry}\n",
" user_weights[0]['id'] = i\n",
" style_function = lambda x: {'color': colors[int(x['id'])]}\n",
" folium.GeoJson(user_weights, style_function=style_function).add_to(m)\n",
" folium.GeoJson(geoJSON_input, style_function=style_function, tooltip='{:.2f}'.format(weight)).add_to(m)\n",
"\n",
"m"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment