Created
August 24, 2020 02:41
-
-
Save ajfriend/75701db3914ab72f9c02fed793dd0f74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"c = {\n", | |
" 'type': 'Polygon',\n", | |
" 'coordinates': [[\n", | |
" [-111.063254, 32.408006, 0.0],\n", | |
" [-111.141004, 32.408821, 0.0],\n", | |
" [-111.144975, 32.411309, 0.0],\n", | |
" [-111.163476, 32.424543, 0.0],\n", | |
" [-111.183195, 32.439046, 0.0],\n", | |
" [-111.266871, 32.501625, 0.0],\n", | |
" [-111.33821 , 32.591251, 0.0],\n", | |
" [-111.314289, 32.613078, 0.0],\n", | |
" [-111.206396, 32.700011, 0.0],\n", | |
" [-111.192094, 32.699503, 0.0],\n", | |
" [-110.981732, 32.600785, 0.0],\n", | |
" [-110.976065, 32.595854, 0.0],\n", | |
" [-110.974906, 32.589309, 0.0],\n", | |
" [-110.970661, 32.560612, 0.0],\n", | |
" [-110.968279, 32.540255, 0.0],\n", | |
" [-110.964928, 32.511301, 0.0],\n", | |
" [-111.034777, 32.423797, 0.0],\n", | |
" [-111.046944, 32.409811, 0.0],\n", | |
" [-111.059237, 32.408281, 0.0],\n", | |
" [-111.063254, 32.408006, 0.0],\n", | |
" ]]\n", | |
"}" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[[-111.063254, 32.408006],\n", | |
" [-111.141004, 32.408821],\n", | |
" [-111.144975, 32.411309],\n", | |
" [-111.163476, 32.424543],\n", | |
" [-111.183195, 32.439046],\n", | |
" [-111.266871, 32.501625],\n", | |
" [-111.33821, 32.591251],\n", | |
" [-111.314289, 32.613078],\n", | |
" [-111.206396, 32.700011],\n", | |
" [-111.192094, 32.699503],\n", | |
" [-110.981732, 32.600785],\n", | |
" [-110.976065, 32.595854],\n", | |
" [-110.974906, 32.589309],\n", | |
" [-110.970661, 32.560612],\n", | |
" [-110.968279, 32.540255],\n", | |
" [-110.964928, 32.511301],\n", | |
" [-111.034777, 32.423797],\n", | |
" [-111.046944, 32.409811],\n", | |
" [-111.059237, 32.408281],\n", | |
" [-111.063254, 32.408006]]" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"tup = [e[:2] for e in c['coordinates'][0]]\n", | |
"tup" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"c['coordinates'][0] = tup" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'8648e8607ffffff',\n", | |
" '8648e8627ffffff',\n", | |
" '8648e862fffffff',\n", | |
" '8648e8637ffffff',\n", | |
" '8648e8707ffffff',\n", | |
" '8648e870fffffff',\n", | |
" '8648e8717ffffff',\n", | |
" '8648e871fffffff',\n", | |
" '8648e8727ffffff',\n", | |
" '8648e872fffffff',\n", | |
" '8648e8737ffffff',\n", | |
" '8648e8747ffffff',\n", | |
" '8648e8757ffffff',\n", | |
" '8648e875fffffff',\n", | |
" '8648e8777ffffff',\n", | |
" '8648e87afffffff'}" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import h3\n", | |
"\n", | |
"h3.polyfill(c, 6, geo_json_conformant=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"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
For issue uber/h3-py#164