diff --git a/examples/python-api.ipynb b/examples/python-api.ipynb new file mode 100644 index 000000000..0994d3eb2 --- /dev/null +++ b/examples/python-api.ipynb @@ -0,0 +1,413 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "51027580-28f6-4945-8bd0-63fbd77d61d9", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/arjunverma/Desktop/Arjun/jupytergis/python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py:15: UserWarning: Importing 'jupytergis_core' outside a proper installation.\n", + " from jupytergis_core.schema import (\n" + ] + } + ], + "source": [ + "from jupytergis import GISDocument" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ac4dceba-c315-43ee-a358-d8ccf8942c31", + "metadata": {}, + "outputs": [], + "source": [ + "doc = GISDocument(\"untitled4.jGIS\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "d25285cf-fc9c-453f-9ac7-5f8857ad1e65", + "metadata": {}, + "outputs": [], + "source": [ + "# doc.add_geojson_layer('france_regions.geojson')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "ae21ac0e-f307-4b23-84c2-b2ce32836c71", + "metadata": {}, + "outputs": [], + "source": [ + "# doc.add_geojson_layer2('france_regions.geojson')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "6f8a675a-b9d3-4ea1-95f9-de4a8d6ed48f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{}" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc.layers" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "48b2d0cc-89b2-496a-9926-63fd4c2993cc", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'type': , 'name': 'GeoJSON Layer', 'visible': True, 'parameters': {'source': '306de8eb-1229-4df5-9005-221ba8bd0e58', 'color': None, 'opacity': 1}, 'filters': {'appliedFilters': [{'feature': None, 'operator': None, 'value': None}], 'logicalOp': None}}\n", + "Base Layer: name='GeoJSON Layer' type= visible=True parameters=IVectorLayer(source='306de8eb-1229-4df5-9005-221ba8bd0e58', color=None, opacity=1.0, symbologyState=None) filters={'appliedFilters': [{'feature': None, 'operator': None, 'value': None}], 'logicalOp': None}\n", + "cool \n", + "Hello world\n" + ] + } + ], + "source": [ + "layer = doc.add_geojson_layer2(\"france_regions.geojson\")\n", + "layer.hello()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "03e71af2-9698-400c-8607-36862946a07e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'filters': {'appliedFilters': [{'feature': None,\n", + " 'operator': None,\n", + " 'value': None}],\n", + " 'logicalOp': None},\n", + " 'name': 'GeoJSON Layer',\n", + " 'parameters': {'color': None,\n", + " 'opacity': 1.0,\n", + " 'source': '306de8eb-1229-4df5-9005-221ba8bd0e58',\n", + " 'symbologyState': None},\n", + " 'type': ,\n", + " 'visible': True}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/var/folders/7t/pscb61vn6t36x8n120434bqh0000gn/T/ipykernel_47062/3411311993.py:4: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/\n", + " pprint(layer._base_layer.dict()) # Pydantic's dict method\n" + ] + } + ], + "source": [ + "from pprint import pprint\n", + "\n", + "# If you want the raw dict form of the base layer\n", + "pprint(layer._base_layer.dict()) # Pydantic's dict method\n", + "layer._base_layer.visible = True" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "13354ec0-a729-42ed-a84a-c0d71dc143ef", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "layer" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "18909f1e-3aff-4d3d-8f68-647d89b359c7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'81bcde7d-cddd-4272-b282-cf197028290c'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc._add_layer(layer)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "e834c820-d097-48d4-9a38-267b21b7311e", + "metadata": {}, + "outputs": [], + "source": [ + "# dir(layer)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "362162f1-2770-4143-a1d5-c0eb090a071f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Showing layer: source='306de8eb-1229-4df5-9005-221ba8bd0e58' color=None opacity=1.0 symbologyState=None\n" + ] + } + ], + "source": [ + "layer.show_layer()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "7c9ee9f6-1a95-4129-97fc-ca3c62af019f", + "metadata": {}, + "outputs": [], + "source": [ + "geojson_data = doc.get_source(layer.parameters.source)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "9957b705-6c51-4297-8bba-ae09133bf6ba", + "metadata": {}, + "outputs": [], + "source": [ + "# %pip install geopandas" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "dd175905-741a-4e20-b9f7-0f928df5a0a6", + "metadata": {}, + "outputs": [], + "source": [ + "import geopandas as gpd" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "6fa4ab5d-ed02-4502-a8ad-a4331a0450f3", + "metadata": {}, + "outputs": [], + "source": [ + "geojson_data = geojson_data[\"parameters\"][\"data\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "cdb83889-0e22-4e70-89ef-c5ee49096267", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dict" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(geojson_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "7cd9ab8f-e135-4255-9c39-b9a8e2689c12", + "metadata": {}, + "outputs": [], + "source": [ + "from shapely.geometry import shape" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "0e764dc1-5862-4402-8c36-729b7ff804d8", + "metadata": {}, + "outputs": [], + "source": [ + "data = []\n", + "geometry = []\n", + "for feature in geojson_data[\"features\"]:\n", + " data.append(feature[\"properties\"])\n", + " geometry.append(shape(feature[\"geometry\"]))\n", + "\n", + "# Create GeoDataFrame\n", + "gdf_from_dict = gpd.GeoDataFrame(data, geometry=geometry, crs=\"EPSG:4326\")" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "ed8ed4d3-52f7-4114-ab35-5bd36e4de323", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
nomcodegeometry
0Île-de-France11POLYGON ((2.59052 49.07965, 2.63327 49.10838, ...
1Centre-Val de Loire24POLYGON ((2.87463 47.52042, 2.88845 47.50943, ...
2Bourgogne-Franche-Comté27POLYGON ((3.62942 46.74946, 3.57569 46.74952, ...
\n", + "
" + ], + "text/plain": [ + " nom code \\\n", + "0 Île-de-France 11 \n", + "1 Centre-Val de Loire 24 \n", + "2 Bourgogne-Franche-Comté 27 \n", + "\n", + " geometry \n", + "0 POLYGON ((2.59052 49.07965, 2.63327 49.10838, ... \n", + "1 POLYGON ((2.87463 47.52042, 2.88845 47.50943, ... \n", + "2 POLYGON ((3.62942 46.74946, 3.57569 46.74952, ... " + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "gdf = gdf_from_dict.iloc[:3]\n", + "gdf" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "10db8be8-933b-47b2-8e71-5c4dc1c8a0a7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'{\"type\": \"FeatureCollection\", \"features\": [{\"id\": \"0\", \"type\": \"Feature\", \"properties\": {\"nom\": \"\\\\u00cele-de-France\", \"code\": \"11\"}, \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[2.5905242793946224, 49.079654846732424], [2.633272965218076, 49.10837621896302], [2.673154178752123, 49.090859401094306], [2.7067286108537023, 49.06571610231719], [2.753551034147009, 49.06074104171223], [2.7870683167938073, 49.075272380356054], [2.7918669791571764, 49.090224385649144], [2.845152480122472, 49.0846582975852], [2.8560893422319023, 49.07003394285967], [2.8949540105299616, 49.077060509386286], [2.9015078805206906, 49.08537404257291], [2.974612129302612, 49.07483790651457], [3.0085155429257675, 49.09151015780461], [3.0483639955943445, 49.086321770811566], [3.071884293834167, 49.117554218816146], [3.1039032023368676, 49.10783847337312], [3.1361260876735515, 49.10736575572267], [3.16523032905892, 49.09965085798759], [3.1535840813505853, 49.08328424779814], [3.1818268776645002, 49.060865198640144], [3.1682883590774806, 49.01667270236993], [3.229176905886298, 48.98841784600257], [3.2518351589230496, 48.97236625695047], [3.2678460373508416, 48.938331129104206], [3.3047494707754015, 48.94876427894454], [3.3130758740800688, 48.9212163651494], [3.3302994547269797, 48.908706088642376], [3.3663472431751384, 48.922836905893014], [3.3828132392962247, 48.88874725594759], [3.380474508825688, 48.874761432854626], [3.404630766733507, 48.86387236235099], [3.452232416190477, 48.856291455303484], [3.4607105852412756, 48.83944139457446], [3.4851874436586847, 48.851908494372864], [3.484964362562067, 48.82500976544345], [3.4321733352035433, 48.81226134369876], [3.442913938608982, 48.78618495446326], [3.409426927872636, 48.78384005486431], [3.395834526122342, 48.75925128896011], [3.4302049079731773, 48.756874901226034], [3.4443842525897947, 48.73668491350176], [3.4697275479340295, 48.73786507384338], [3.4643028353269045, 48.707377209765006], [3.4693877334848082, 48.68643581459289], [3.4406134906014127, 48.6636539025972], [3.460426313142606, 48.65300999879329], [3.5174997752390147, 48.64336703334491], [3.5190711976645597, 48.633474580141225], [3.5556137492385345, 48.62028467657408], [3.5038535314822115, 48.6048091344709], [3.4975003134409723, 48.58995747369995], [3.4655161591022283, 48.57048567886506], [3.479607557239746, 48.54471109171053], [3.4591902801865113, 48.53074024476159], [3.4234423807070566, 48.533562692399734], [3.4053980660358945, 48.528012199625785], [3.4348599344666386, 48.49751072268098], [3.388359827890943, 48.480408300039215], [3.4064783284931712, 48.4524502326185], [3.3919598867876517, 48.424322153455364], [3.422082006455869, 48.413341906536964], [3.4147915595010967, 48.390273038820325], [3.3833187883415756, 48.39970860491622], [3.367217075047188, 48.39431654152582], [3.3651592673815314, 48.37228068710627], [3.305153213312036, 48.37287323488759], [3.282397556791885, 48.37751802756359], [3.254382220567969, 48.36502185965591], [3.232843707551971, 48.37032930740775], [3.2018573040530143, 48.36401635870226], [3.1398687617633554, 48.37259875797597], [3.0988849903520745, 48.35782222270563], [3.0495188960927044, 48.36012035556557], [3.036760677253472, 48.34009779475704], [3.041677936242915, 48.329416667963116], [3.015901008416285, 48.3079017396547], [3.043627253848888, 48.27202235761227], [3.0051556578134635, 48.20767000034546], [2.97446503722382, 48.20555285255294], [2.970958045601008, 48.194187673485665], [2.9347486048838207, 48.17882262621194], [2.936314411640624, 48.1633917441478], [2.868032820232008, 48.156433549044586], [2.8208799789852854, 48.12966447731962], [2.7978126665223124, 48.14068615599144], [2.7989445730680167, 48.16827665010273], [2.7414685556447598, 48.15977844911796], [2.7551983055667155, 48.145653478490786], [2.720460981753342, 48.136910896310766], [2.7065470696044738, 48.12481924580505], [2.6634205012712795, 48.12220248073456], [2.6397338993017683, 48.1388605931352], [2.602684217604197, 48.13148889808521], [2.570562642830993, 48.14081569138084], [2.537506945660482, 48.14033979679666], [2.521518685158647, 48.127300215727736], [2.4903153051303115, 48.12660259180864], [2.460116447222927, 48.13685254342551], [2.4832376593500602, 48.164518230078265], [2.5063270278885916, 48.15643757520199], [2.5093663344872534, 48.18250926382449], [2.523126693688509, 48.19489310648136], [2.5068882455094257, 48.22598658432872], [2.4690901704508605, 48.255272821570486], [2.452518016092004, 48.25003251288878], [2.4237635277023717, 48.260297326582666], [2.4210918870276967, 48.298668261849855], [2.402664267131608, 48.320719459421184], [2.3633118415981462, 48.309600437933916], [2.3277014892177683, 48.33305786731142], [2.312590884489921, 48.330802741661444], [2.2954192430595457, 48.308226039086286], [2.238046845675527, 48.316373357629175], [2.223911064819703, 48.3364180215832], [2.2022493722769347, 48.344596745334684], [2.1806941723291215, 48.31168043030938], [2.155707101498331, 48.30449560310474], [2.081503651069427, 48.29360440985604], [2.052708364877964, 48.29547390947902], [2.0438104559378143, 48.2864493366448], [1.9940847180593788, 48.286585877943075], [1.9752916566344318, 48.28719843612737], [1.9592272366957604, 48.308689574530625], [1.9799848326906437, 48.31848007972407], [1.9699915637784469, 48.33969146951863], [1.9868210109251592, 48.36214189229105], [1.9734600276085819, 48.38883055198841], [1.9765777946992387, 48.39938447447991], [1.9258935288275238, 48.412738189076535], [1.940657409608177, 48.42520626181189], [1.9221489648373706, 48.457600286064135], [1.9064022701801788, 48.44014576962788], [1.8716851573650342, 48.43978475842447], [1.84486306037181, 48.4493607065379], [1.8321369890615689, 48.467581442678565], [1.8032057888939028, 48.472565678495286], [1.7768442507697113, 48.50931096191216], [1.775751488475668, 48.52770729661422], [1.7872450519775867, 48.55374456486673], [1.7653297161980415, 48.56937104099974], [1.7092527874670105, 48.57802434626235], [1.7019890546581085, 48.58499862181419], [1.714895681919355, 48.61439494545783], [1.6662188615195896, 48.613706715891], [1.651574528306872, 48.63812870428749], [1.603118482168126, 48.66241796207503], [1.6117708691618606, 48.68947111646258], [1.579545829918285, 48.70181187348942], [1.6263993499269267, 48.748094297484094], [1.5875947031508344, 48.773602302755286], [1.5756742260519878, 48.7905067944881], [1.5912030850964909, 48.814869639400584], [1.5772685877162862, 48.84436076548629], [1.581598875031263, 48.85499897015231], [1.5462315883376268, 48.87242890235984], [1.5595052783343866, 48.88205164409549], [1.5385208308731109, 48.90668492167043], [1.5386150005667363, 48.92179645733065], [1.5073440226070087, 48.927598989147334], [1.5015238197988665, 48.94105360615515], [1.4974212515808907, 48.97955944476306], [1.477085024550759, 48.978790316157344], [1.4770779834042216, 49.01679764336922], [1.4577625828067995, 49.026291046220386], [1.4474328265726297, 49.04518805211747], [1.4607983669865394, 49.0627440580796], [1.4848834480593345, 49.05154791492779], [1.5380423840651944, 49.072342033316], [1.5570756944651978, 49.06962240086733], [1.6017185942276444, 49.08450261108525], [1.6087960706299218, 49.07789415353795], [1.6350518648476458, 49.11430020855939], [1.655777439712795, 49.13016217033744], [1.6643738026115165, 49.15336752369717], [1.674090204376027, 49.210248479159524], [1.7043642065965865, 49.232201775163404], [1.7341091564710822, 49.221278789282294], [1.7421373979981678, 49.18015527802457], [1.755165127607803, 49.17454501384096], [1.7954686863275515, 49.18525912523885], [1.845548847714221, 49.169897638882595], [1.877040859056052, 49.17144524902654], [1.8852389528169067, 49.16263786454188], [1.9314802344723212, 49.17417045483985], [1.9607171449401366, 49.173518197205695], [1.973760882151743, 49.18378113635129], [2.0006083248213287, 49.175708039448175], [2.0749104023995684, 49.20868708172066], [2.0968812642737786, 49.18975715797898], [2.1327389034606554, 49.191378260554046], [2.1819500283812623, 49.17367773782481], [2.218650036331584, 49.180682600571025], [2.252488213818398, 49.15288152246086], [2.2864129770481765, 49.15992057659305], [2.3109290446865427, 49.18640655833579], [2.3462570508145517, 49.161815824563625], [2.3912888696248515, 49.14934773205012], [2.4131026213629148, 49.152351151856486], [2.471584849664169, 49.13543134509872], [2.5032579551258722, 49.11758406300134], [2.4899309091229616, 49.10636117791936], [2.5581713639343153, 49.09838623642425], [2.5905242793946224, 49.079654846732424]]]}}, {\"id\": \"1\", \"type\": \"Feature\", \"properties\": {\"nom\": \"Centre-Val de Loire\", \"code\": \"24\"}, \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[2.8746252064056805, 47.52042311253978], [2.8884546532335578, 47.5094282811585], [2.9026727758043678, 47.4787904760825], [2.931175112801269, 47.441669509538606], [2.9194707204649397, 47.407274676600125], [2.8734906167112504, 47.34839595881793], [2.8767969741076427, 47.321752773704915], [2.9077684884182546, 47.31098769398195], [2.9378686076548557, 47.287718487007425], [2.9834041014118906, 47.25976318037284], [2.9816846477683376, 47.22199695723395], [3.0092825607816684, 47.17991916254789], [3.0280852399597813, 47.129067685143], [3.0313750673889857, 47.09247842625923], [3.0232152406674615, 47.06261687352466], [3.0627479524794685, 47.04527994600743], [3.0757508386893258, 47.019144570799824], [3.0628630913516144, 46.98581276267424], [3.0793297925031697, 46.955118753700084], [3.0502941730720203, 46.9106303658982], [3.0680947893123323, 46.877676731330354], [3.069533804251037, 46.85306859289044], [3.059347134977098, 46.82726033600817], [3.0320681893946824, 46.794911188525944], [2.9599146908207157, 46.8038765767733], [2.9081337416117115, 46.78790090388258], [2.9097996708207035, 46.77934846021115], [2.827616388160227, 46.73528787880108], [2.791229376607484, 46.73345369143159], [2.758717331696372, 46.71770479874165], [2.737293702840373, 46.74315745422507], [2.7144961054529793, 46.74448968334189], [2.701686181879871, 46.72775447664072], [2.647884573027338, 46.688911012473135], [2.623913816878901, 46.656626585968894], [2.5977652900203827, 46.66465075679083], [2.5721840644866165, 46.65944372206644], [2.5966478252098466, 46.637219569816494], [2.577951915975513, 46.60379087601659], [2.6011237640888596, 46.590178123200815], [2.6098613959683155, 46.55013821923558], [2.536652020779054, 46.51969984591659], [2.5286102816734966, 46.52948202499876], [2.4991214173027565, 46.52128856511456], [2.482928804775826, 46.532697444644036], [2.4454932330861086, 46.520050656829746], [2.368300280591156, 46.518434763382956], [2.3520035556502914, 46.512211347274814], [2.3054653620681904, 46.47543251470377], [2.2857578150118907, 46.45351915029325], [2.2810476101300576, 46.42040537318101], [2.2498713444180876, 46.426364231750945], [2.2138451955651943, 46.423141210473545], [2.1975702533853765, 46.42829596011364], [2.1677857181383846, 46.42406650081809], [2.129684686571857, 46.41986520092511], [2.088941803334241, 46.40890318674806], [2.074201476301987, 46.41984302086565], [2.044395406151348, 46.42134446075375], [1.9930823669027022, 46.43091738935582], [1.978108199916569, 46.439771706882276], [1.9243082864873586, 46.431902226728816], [1.909176472236739, 46.44350179050311], [1.883436954441824, 46.43255455176469], [1.8195004176655625, 46.430038338950894], [1.7983765894227512, 46.45481762095847], [1.747590198721343, 46.45002145600438], [1.7601258090399783, 46.42758992898391], [1.7277004157566196, 46.38940888777561], [1.710900805328006, 46.39205717074327], [1.6836025202595086, 46.41817777856285], [1.6448464161558112, 46.38681584908517], [1.6143011395442397, 46.405298584782024], [1.5696928311710425, 46.4054957864533], [1.5462010463391824, 46.39346394164149], [1.543962708576285, 46.416887448744504], [1.5223068332769556, 46.42652499450049], [1.462936752493747, 46.375350693466984], [1.4353808001913293, 46.363844088424806], [1.4151905101137505, 46.34721849587296], [1.4090311642821585, 46.3613359928752], [1.3835265726019255, 46.374757364316125], [1.3560228953092233, 46.40012317441316], [1.3223399070687456, 46.38965357258241], [1.3030567860553472, 46.37099465262579], [1.2604032451287535, 46.37878248650986], [1.2191909673622259, 46.36592410433378], [1.2047624195766258, 46.387692968021526], [1.1772799568053671, 46.38395162215293], [1.2109861172875847, 46.42936675668184], [1.1516045347766355, 46.449236175811976], [1.152977857618218, 46.47295586110232], [1.1349676142912506, 46.495261976149834], [1.1491434460646581, 46.50220256803704], [1.1082908975477561, 46.53150940181887], [1.08759324171297, 46.538172760099805], [1.0206069888359919, 46.53709643301311], [1.0147644249831798, 46.56776399882199], [0.987237034592862, 46.56556286906366], [0.9408377357519268, 46.581410311122475], [0.9158653080538118, 46.59663148752451], [0.8943018154002151, 46.62573665182289], [0.9065157405117292, 46.64774942034653], [0.9084421594440936, 46.6826701222059], [0.9279553620387494, 46.69539122809664], [0.9010383725080395, 46.73609229312116], [0.8674688807081561, 46.74821910504847], [0.8279817587178017, 46.776816236170745], [0.8119017840639386, 46.79450796471714], [0.8093213661875756, 46.827858093390724], [0.7521109761823577, 46.86086544125436], [0.704324392050786, 46.903293353155846], [0.7062532556123257, 46.937154623849935], [0.692569282364634, 46.97430706301784], [0.6362054885332586, 46.985451805972254], [0.6188741963763473, 47.00746096968646], [0.5669489614197056, 47.00227037444166], [0.5783449036180749, 46.97981081817415], [0.6011756847806528, 46.97309082433285], [0.6015594112278456, 46.95910993478791], [0.5644222278144092, 46.95552996701939], [0.5392917082788095, 46.960220880583776], [0.5027297280171042, 46.9579123909043], [0.44480383249233546, 46.94114889283753], [0.4387096602536596, 46.929582071059045], [0.3665152631758488, 46.94955720761298], [0.3248406111614126, 46.93065213256517], [0.31122704760535835, 46.93783959199593], [0.30073625724988334, 46.97382765864781], [0.3081773026194614, 46.99988348323911], [0.2986715021217093, 47.01959741824875], [0.3093302509672645, 47.04413338267026], [0.29823142261819696, 47.05391872520871], [0.2718544387898612, 47.04638904119169], [0.2455423301785185, 47.07128604001384], [0.20800102904621295, 47.05323202361692], [0.1742206159576792, 47.07127519606643], [0.20095302486598468, 47.09125887635545], [0.18146114771856547, 47.11438824881292], [0.15685150997252176, 47.103344382080465], [0.1347219236888625, 47.1078700305567], [0.13613090268194533, 47.121580554147506], [0.07637120084195233, 47.12393194888823], [0.05382761471070587, 47.16373008265526], [0.06659419807362671, 47.18979325990068], [0.0532775371077964, 47.19718486964462], [0.07249546123856535, 47.22050992119078], [0.06792548837999822, 47.2473308040697], [0.0785963884113725, 47.28394130124859], [0.11746224213975613, 47.33234274537884], [0.14729836062565832, 47.34537579230401], [0.14939629089256964, 47.36226337889678], [0.18295674766364445, 47.38033212018486], [0.16799336737564852, 47.3869314962575], [0.1676400513828326, 47.405415942568375], [0.18528045906678275, 47.42473344937359], [0.1812364735767597, 47.4526491231434], [0.20921732522172254, 47.49365838444261], [0.22010925240137172, 47.50195329711621], [0.22484312443395177, 47.52727704290141], [0.20150359657525238, 47.544318760659884], [0.2150171714816557, 47.57064544903573], [0.23453424561335756, 47.577982037960055], [0.2300017263531844, 47.60839829191704], [0.2592506238809073, 47.61225007215638], [0.27798986367452727, 47.59737754800952], [0.32305499229698215, 47.59299821090531], [0.3395858922127171, 47.579470515833165], [0.37848363992659617, 47.568525933307754], [0.4025770030261876, 47.57851243241093], [0.39696475621012467, 47.59398591871484], [0.36465541592168343, 47.62601597769362], [0.396250654091774, 47.640846063055804], [0.4239064036884163, 47.61782807903746], [0.449927725905683, 47.619326961976206], [0.45663070361835445, 47.63882641156769], [0.49841790772099426, 47.644762985249095], [0.5168171483414108, 47.6548633763592], [0.5446201655241357, 47.656594675363216], [0.5599236683507411, 47.67081925112141], [0.5847693599955615, 47.66857981952678], [0.6148109083098767, 47.682749216116356], [0.6144311990931555, 47.69421364605317], [0.5805178732790718, 47.71232800971273], [0.6116040970811059, 47.728130849502094], [0.6207093570907236, 47.747478130583154], [0.6512736394121261, 47.75525397111593], [0.7248506777855144, 47.79889099623824], [0.7452461943264459, 47.82624263074177], [0.7745788175007324, 47.83968729513432], [0.7573343557395469, 47.8911737517487], [0.7805065684044099, 47.91037691407999], [0.8091382962389404, 47.91066255080899], [0.8171444727137281, 47.93447148791446], [0.8454683997304765, 47.9413323536207], [0.8376537080820077, 47.96869214349436], [0.8186564019800159, 47.9892543363892], [0.8323705747596303, 47.996592919852844], [0.8405346727531238, 48.021049640847735], [0.7975514233427093, 48.03724057968432], [0.8011883732648392, 48.0715172542445], [0.8430226369432118, 48.07264184794484], [0.8412172317044129, 48.10306240932052], [0.8525696983122546, 48.133605674559426], [0.913802022562964, 48.13512781830264], [0.9116186783263119, 48.14886135015183], [0.8619836907733601, 48.16682130452495], [0.8367739335625146, 48.166991974853865], [0.797655838494225, 48.19445221754921], [0.8302416950484665, 48.21430027818372], [0.7875964742272762, 48.26131463776064], [0.7958184564245077, 48.28648186022423], [0.7688672771787132, 48.32194393371593], [0.7854319060188925, 48.34042724028456], [0.8187477629538905, 48.3492990187552], [0.8837069426865347, 48.35671469741493], [0.9090291135378351, 48.37025942165492], [0.9486303005350746, 48.40254075139077], [0.9439900556805834, 48.41543779690512], [0.9584142860496184, 48.442595257597894], [0.9357072927920254, 48.475553713886015], [0.956288496333069, 48.48228110680156], [0.9539997024327551, 48.50383926047164], [0.9667159729358187, 48.52408891339411], [0.9226089134985012, 48.5377152127879], [0.9387576535104647, 48.55055845317247], [0.8912620563004201, 48.57217735609871], [0.8676826582446395, 48.57348477486485], [0.8495690718886973, 48.584317085863454], [0.8465847869380818, 48.60477987546661], [0.8177592533729132, 48.616321964340834], [0.8268154990669214, 48.63060614219509], [0.8148191028635925, 48.67016796018795], [0.8276671061162353, 48.68072356503085], [0.8619896827437209, 48.68705769224572], [0.876707237647973, 48.71549244581689], [0.9023959771326227, 48.7106473551684], [0.9552461079026382, 48.71678344138858], [0.9614508974400996, 48.7257249507322], [1.0140709189239645, 48.7280968183202], [1.0590671926768536, 48.756763319856546], [1.0957317749783022, 48.74871690601713], [1.1186480947364004, 48.75458615785833], [1.121402821755998, 48.789193818459175], [1.1521108654240828, 48.78556141919787], [1.159490184478893, 48.769724918274406], [1.184730602501536, 48.77263016325766], [1.2460222122058793, 48.7696776023494], [1.270215830640388, 48.75748087478701], [1.300298160774345, 48.76753862976326], [1.3195484140595357, 48.76096509555226], [1.3769640090609683, 48.791769052281], [1.3583524111815377, 48.8164325477948], [1.3621810029001884, 48.834179003372945], [1.4093616066102121, 48.86115348650526], [1.4549910456481823, 48.87032343188624], [1.471281965082692, 48.897831449765356], [1.4483097630235757, 48.92433060014346], [1.4613084344852056, 48.93755797274698], [1.5015238197988665, 48.94105360615515], [1.5073440226070087, 48.927598989147334], [1.5386150005667363, 48.92179645733065], [1.5385208308731109, 48.90668492167043], [1.5595052783343866, 48.88205164409549], [1.5462315883376268, 48.87242890235984], [1.581598875031263, 48.85499897015231], [1.5772685877162862, 48.84436076548629], [1.5912030850964909, 48.814869639400584], [1.5756742260519878, 48.7905067944881], [1.5875947031508344, 48.773602302755286], [1.6263993499269267, 48.748094297484094], [1.579545829918285, 48.70181187348942], [1.6117708691618606, 48.68947111646258], [1.603118482168126, 48.66241796207503], [1.651574528306872, 48.63812870428749], [1.6662188615195896, 48.613706715891], [1.714895681919355, 48.61439494545783], [1.7019890546581085, 48.58499862181419], [1.7092527874670105, 48.57802434626235], [1.7653297161980415, 48.56937104099974], [1.7872450519775867, 48.55374456486673], [1.775751488475668, 48.52770729661422], [1.7768442507697113, 48.50931096191216], [1.8032057888939028, 48.472565678495286], [1.8321369890615689, 48.467581442678565], [1.84486306037181, 48.4493607065379], [1.8716851573650342, 48.43978475842447], [1.9064022701801788, 48.44014576962788], [1.9221489648373706, 48.457600286064135], [1.940657409608177, 48.42520626181189], [1.9258935288275238, 48.412738189076535], [1.9765777946992387, 48.39938447447991], [1.9734600276085819, 48.38883055198841], [1.9868210109251592, 48.36214189229105], [1.9699915637784469, 48.33969146951863], [1.9799848326906437, 48.31848007972407], [1.9592272366957604, 48.308689574530625], [1.9752916566344318, 48.28719843612737], [1.9940847180593788, 48.286585877943075], [2.0438104559378143, 48.2864493366448], [2.052708364877964, 48.29547390947902], [2.081503651069427, 48.29360440985604], [2.155707101498331, 48.30449560310474], [2.1806941723291215, 48.31168043030938], [2.2022493722769347, 48.344596745334684], [2.223911064819703, 48.3364180215832], [2.238046845675527, 48.316373357629175], [2.2954192430595457, 48.308226039086286], [2.312590884489921, 48.330802741661444], [2.3277014892177683, 48.33305786731142], [2.3633118415981462, 48.309600437933916], [2.402664267131608, 48.320719459421184], [2.4210918870276967, 48.298668261849855], [2.4237635277023717, 48.260297326582666], [2.452518016092004, 48.25003251288878], [2.4690901704508605, 48.255272821570486], [2.5068882455094257, 48.22598658432872], [2.523126693688509, 48.19489310648136], [2.5093663344872534, 48.18250926382449], [2.5063270278885916, 48.15643757520199], [2.4832376593500602, 48.164518230078265], [2.460116447222927, 48.13685254342551], [2.4903153051303115, 48.12660259180864], [2.521518685158647, 48.127300215727736], [2.537506945660482, 48.14033979679666], [2.570562642830993, 48.14081569138084], [2.602684217604197, 48.13148889808521], [2.6397338993017683, 48.1388605931352], [2.6634205012712795, 48.12220248073456], [2.7065470696044738, 48.12481924580505], [2.720460981753342, 48.136910896310766], [2.7551983055667155, 48.145653478490786], [2.7414685556447598, 48.15977844911796], [2.7989445730680167, 48.16827665010273], [2.7978126665223124, 48.14068615599144], [2.8208799789852854, 48.12966447731962], [2.868032820232008, 48.156433549044586], [2.936314411640624, 48.1633917441478], [2.9712637126470374, 48.15183377076339], [2.990882804955562, 48.15249378691091], [3.0294654865478936, 48.13320717199774], [3.0498962046090887, 48.088837886069456], [3.0504714242752176, 48.072334131124755], [3.0883177986514796, 48.05393639481059], [3.1040899600034066, 48.01354534990655], [3.1245523178040195, 48.006029252910174], [3.1284501214452565, 47.97097324034548], [3.0784722436737018, 47.93141992007049], [3.0646112850926173, 47.93051941081648], [3.00722631015934, 47.895294555605346], [3.0053630487182557, 47.86404745363208], [3.029058320822418, 47.857123076441624], [3.0297012521374107, 47.83508204151216], [3.0125379851547156, 47.834374131761656], [3.0281191130010834, 47.80064806639638], [3.023798094359226, 47.78655467899923], [2.988221260489061, 47.78603448891204], [2.954736881556772, 47.77555900512353], [2.9496989968031038, 47.76587258709822], [2.9145173600355263, 47.76938033260984], [2.8566660682192713, 47.76092647077394], [2.848796639073614, 47.72588667336868], [2.858973240721994, 47.71131839341009], [2.911669508308486, 47.69146053421784], [2.9181549279743337, 47.66979136771246], [2.954234275262721, 47.64577868896602], [2.936290512560618, 47.63665230316903], [2.9403094506517125, 47.60348550057479], [2.9622747369522457, 47.57678810211018], [2.9765380120036067, 47.56942879709582], [2.95865823105343, 47.55738006412381], [2.914297452553034, 47.56597018271849], [2.890770179974213, 47.55309660602271], [2.8574899628231805, 47.552844658956644], [2.8489038940037736, 47.53754044480101], [2.8746252064056805, 47.52042311253978]]]}}, {\"id\": \"2\", \"type\": \"Feature\", \"properties\": {\"nom\": \"Bourgogne-Franche-Comt\\\\u00e9\", \"code\": \"27\"}, \"geometry\": {\"type\": \"Polygon\", \"coordinates\": [[[3.629423683496518, 46.74945902193754], [3.575688644059658, 46.74951576942387], [3.598004570548422, 46.72398257750036], [3.5773110866449174, 46.71485003618856], [3.550392218815862, 46.715864672081594], [3.5601217846433015, 46.68944384651715], [3.546479370174174, 46.67829016254972], [3.523959952566555, 46.685994912475735], [3.4885699471242644, 46.6601824726314], [3.45529917195652, 46.65239553162601], [3.4473359853067485, 46.66355627140273], [3.453772658174005, 46.68414192059341], [3.432977086126445, 46.69334363262723], [3.43414613166678, 46.711906018109566], [3.3877607382601562, 46.71481835659156], [3.366446289777872, 46.69126127383442], [3.3467088070518343, 46.68441634541089], [3.3139717258866157, 46.688751593416065], [3.3009216002863893, 46.7163033886406], [3.2697920192933188, 46.71674092868996], [3.2155498733945853, 46.68289184476865], [3.197261486410674, 46.679926344970944], [3.1631563644760856, 46.69354021702288], [3.129775813721409, 46.72720423640006], [3.0839363013486563, 46.73762859045693], [3.049065356287102, 46.75807894189366], [3.0320681893946824, 46.794911188525944], [3.059347134977098, 46.82726033600817], [3.069533804251037, 46.85306859289044], [3.0680947893123323, 46.877676731330354], [3.0502941730720203, 46.9106303658982], [3.0793297925031697, 46.955118753700084], [3.0628630913516144, 46.98581276267424], [3.0757508386893258, 47.019144570799824], [3.0627479524794685, 47.04527994600743], [3.0232152406674615, 47.06261687352466], [3.0313750673889857, 47.09247842625923], [3.0280852399597813, 47.129067685143], [3.0092825607816684, 47.17991916254789], [2.9816846477683376, 47.22199695723395], [2.9834041014118906, 47.25976318037284], [2.9378686076548557, 47.287718487007425], [2.9077684884182546, 47.31098769398195], [2.8767969741076427, 47.321752773704915], [2.8734906167112504, 47.34839595881793], [2.9194707204649397, 47.407274676600125], [2.931175112801269, 47.441669509538606], [2.9026727758043678, 47.4787904760825], [2.8884546532335578, 47.5094282811585], [2.8746252064056805, 47.52042311253978], [2.8489038940037736, 47.53754044480101], [2.8574899628231805, 47.552844658956644], [2.890770179974213, 47.55309660602271], [2.914297452553034, 47.56597018271849], [2.95865823105343, 47.55738006412381], [2.9765380120036067, 47.56942879709582], [2.9622747369522457, 47.57678810211018], [2.9403094506517125, 47.60348550057479], [2.936290512560618, 47.63665230316903], [2.954234275262721, 47.64577868896602], [2.9181549279743337, 47.66979136771246], [2.911669508308486, 47.69146053421784], [2.858973240721994, 47.71131839341009], [2.848796639073614, 47.72588667336868], [2.8566660682192713, 47.76092647077394], [2.9145173600355263, 47.76938033260984], [2.9496989968031038, 47.76587258709822], [2.954736881556772, 47.77555900512353], [2.988221260489061, 47.78603448891204], [3.023798094359226, 47.78655467899923], [3.0281191130010834, 47.80064806639638], [3.0125379851547156, 47.834374131761656], [3.0297012521374107, 47.83508204151216], [3.029058320822418, 47.857123076441624], [3.0053630487182557, 47.86404745363208], [3.00722631015934, 47.895294555605346], [3.0646112850926173, 47.93051941081648], [3.0784722436737018, 47.93141992007049], [3.1284501214452565, 47.97097324034548], [3.1245523178040195, 48.006029252910174], [3.1040899600034066, 48.01354534990655], [3.0883177986514796, 48.05393639481059], [3.0504714242752176, 48.072334131124755], [3.0498962046090887, 48.088837886069456], [3.0294654865478936, 48.13320717199774], [2.990882804955562, 48.15249378691091], [2.9712637126470374, 48.15183377076339], [2.936314411640624, 48.1633917441478], [2.9347486048838207, 48.17882262621194], [2.970958045601008, 48.194187673485665], [2.97446503722382, 48.20555285255294], [3.0051556578134635, 48.20767000034546], [3.043627253848888, 48.27202235761227], [3.015901008416285, 48.3079017396547], [3.041677936242915, 48.329416667963116], [3.036760677253472, 48.34009779475704], [3.0495188960927044, 48.36012035556557], [3.0988849903520745, 48.35782222270563], [3.1398687617633554, 48.37259875797597], [3.2018573040530143, 48.36401635870226], [3.232843707551971, 48.37032930740775], [3.254382220567969, 48.36502185965591], [3.282397556791885, 48.37751802756359], [3.305153213312036, 48.37287323488759], [3.3651592673815314, 48.37228068710627], [3.367217075047188, 48.39431654152582], [3.3833187883415756, 48.39970860491622], [3.4147915595010967, 48.390273038820325], [3.427513158445058, 48.359980231681526], [3.4525858660423605, 48.374390245729586], [3.4986883356303173, 48.368618101138466], [3.5325118583181596, 48.340525877771384], [3.5634013639699584, 48.32144364439587], [3.566569286931659, 48.30742854994862], [3.5879668741436643, 48.30081000040951], [3.587183966868095, 48.280173420842885], [3.6168043332338455, 48.27133989890988], [3.624328073587777, 48.25452852774026], [3.600078611097097, 48.23703622325982], [3.6216173506103138, 48.22574039972581], [3.6111556712475656, 48.21192894753078], [3.57518637671701, 48.18874134782558], [3.594183989487009, 48.17887516119051], [3.6195505299659145, 48.190784479669105], [3.6414970437080063, 48.18393657752057], [3.667869602845747, 48.1392119036121], [3.7050170955645534, 48.14431394210169], [3.740291245795231, 48.16970783293559], [3.754823906575138, 48.150241865949376], [3.739719908908732, 48.13275411908254], [3.773282122246105, 48.12969525627175], [3.8049683849961107, 48.10254956014992], [3.806792668443169, 48.083864090347966], [3.824612213123349, 48.06128779150571], [3.8242989358275574, 48.04289541931859], [3.8706198703197394, 48.01563556441249], [3.839811254672786, 48.00389003724434], [3.850029315571996, 47.98379240721269], [3.8783088264909926, 47.979417724331554], [3.900190065880429, 47.99790876198765], [3.91469046126473, 47.97569343810935], [3.9015952504180182, 47.93863384246034], [3.9480945711713997, 47.93089676516494], [3.985962466837663, 47.93063908075462], [4.003855529645679, 47.94203480301055], [4.01814220173801, 47.928474566092724], [4.045237544702236, 47.92596854676534], [4.061270050327684, 47.945562416892294], [4.092978649387006, 47.94297672164551], [4.1117857473984065, 47.926995657517516], [4.166327039100888, 47.95980433221276], [4.2078337319682335, 47.94659557765659], [4.206741721722166, 47.972203894649205], [4.228464403152438, 47.96915282956105], [4.2221457478233475, 47.94969678465566], [4.242723875606858, 47.931956917411135], [4.265599591370342, 47.924116159008285], [4.2934241069450065, 47.92567623483797], [4.3090036167800365, 47.96117328277752], [4.351286047683726, 47.95658154025503], [4.414346270874161, 47.968206710901], [4.448998378066956, 47.957154747571174], [4.4932784015747025, 47.96880579277352], [4.518171359735413, 47.96658777645795], [4.5599688756782095, 47.97142319625819], [4.535820168596839, 48.001210026464854], [4.582678644289108, 48.02946360186476], [4.6168068514656495, 48.031366971594], [4.67322963618766, 48.015051709502096], [4.704238250439468, 48.0202323762063], [4.719943437560306, 48.00889645519276], [4.749300809603172, 48.00425102648959], [4.789083695644797, 48.00782938255744], [4.794634345104126, 47.983197869158744], [4.785061370779013, 47.968869095555945], [4.811007449975246, 47.95932655708529], [4.845182055142008, 47.96125251907535], [4.866096820746109, 47.94050603305215], [4.828942462053263, 47.915128709594974], [4.857004574909452, 47.895855881593434], [4.87629817749016, 47.92022401352716], [4.901848449197037, 47.921289405231384], [4.928173323343671, 47.886876403893034], [4.9282302679425625, 47.871121167237085], [4.9540942495981195, 47.8667681480835], [4.9683502146365655, 47.83194135820226], [4.993918239441858, 47.81957144123197], [4.987227991995704, 47.8032996343454], [4.918299821120011, 47.7773135776728], [4.930742567556667, 47.76133580408352], [4.949610301299183, 47.765002530384045], [4.971770458339338, 47.73022100712152], [4.953807643894032, 47.70691553121908], [4.959844644041361, 47.69697375959394], [4.992275225837213, 47.688313503769756], [5.030001604156784, 47.70940841478221], [5.0435872776506425, 47.676515292793226], [5.084909015051583, 47.65725535909673], [5.1282137463189255, 47.64769555171287], [5.178340930532218, 47.680951862214265], [5.173597037303847, 47.65256871236608], [5.211414189836741, 47.64189107719557], [5.239232274239111, 47.61613009897604], [5.238668295142944, 47.597284983235], [5.252920215668424, 47.57694786282474], [5.299837418963084, 47.60492946802028], [5.340003771124325, 47.609065915523516], [5.354893869684326, 47.59131447740441], [5.374078595885573, 47.60454165278582], [5.37317594209649, 47.61838294374159], [5.405745536478159, 47.646866141018315], [5.406342872021028, 47.673400744473895], [5.4460337898832885, 47.67077575883233], [5.482567919490752, 47.684602874896335], [5.529778304397354, 47.67282923798152], [5.567204936430051, 47.70523436852804], [5.585005103022503, 47.69979015765272], [5.596682241448045, 47.67168603172257], [5.6534056633858105, 47.67738242296545], [5.690079801415203, 47.684838574927916], [5.684123936651815, 47.711966155758596], [5.693342993991239, 47.737537821735295], [5.709442412269412, 47.745127245662815], [5.705093217659827, 47.76911094285444], [5.679969716046147, 47.769967881716525], [5.681940162654595, 47.806412809419605], [5.699885101970957, 47.82390335263593], [5.732629873750381, 47.81759710089163], [5.746056257349712, 47.82359612703334], [5.744128331452809, 47.84867639845901], [5.76119123886598, 47.85933449216956], [5.805624457872526, 47.847311152266364], [5.851317308296247, 47.905988473584586], [5.869970150074121, 47.900706913078324], [5.890864473987194, 47.910829841401245], [5.884726375202079, 47.926047148569474], [5.900112413513003, 47.94475092005572], [5.918042584312377, 47.94735978283618], [5.918281347414071, 47.9655809864854], [5.9367444429976315, 47.978872441043904], [5.95951518224341, 47.96583761413322], [5.937717530374109, 47.95093996886656], [5.9537128429228625, 47.93703033418094], [5.9707779241858585, 47.95720515925631], [5.994585023938386, 47.957843619961515], [6.023512782425089, 47.97819459549159], [6.0411805356860935, 48.004423104387435], [6.131397185816461, 48.024084417358715], [6.156025724419171, 48.00640454629518], [6.1523863211856415, 47.99509120117254], [6.167984818891344, 47.95235039236555], [6.193308012990422, 47.953186926635745], [6.208333130052072, 47.93959154159432], [6.237987058178878, 47.93284210198345], [6.27733365541217, 47.95380917897212], [6.324502244506514, 47.94927719089294], [6.366159798724643, 47.96194440724777], [6.43172063760481, 47.94381556163065], [6.455958900669549, 47.90676595953145], [6.476305388045899, 47.89135525473161], [6.5421528235861155, 47.90261056529581], [6.563418085973325, 47.931389307581], [6.6073149335019385, 47.943147742357816], [6.641076475620301, 47.91580834582307], [6.643740194905068, 47.90503177099352], [6.703673452230481, 47.88141530820336], [6.737768277119198, 47.8615661276394], [6.784821909572192, 47.84962275516846], [6.792206691054161, 47.830065844691816], [6.823538854548165, 47.81305372458858], [6.846179818400714, 47.822945196999186], [6.848453009671943, 47.80186631777955], [6.862439977221479, 47.786366479297826], [6.924003092082664, 47.77046856849051], [6.940432511420332, 47.77156566113129], [6.971172049261423, 47.75268332188395], [7.011758808530528, 47.741727719619604], [7.0374240128839105, 47.72163936009252], [7.026487154962489, 47.70099973832609], [7.046314752908177, 47.67150171047833], [7.018871382727326, 47.65067487496959], [7.004983231421509, 47.61938273174142], [7.025415883306456, 47.59267760605909], [7.064719544691056, 47.60105755104757], [7.086270201422721, 47.592562199657216], [7.106219108143236, 47.55138203283421], [7.135819374783416, 47.53646303183533], [7.130345969302944, 47.50302658239207], [7.111058458608464, 47.49490275577542], [7.066595656975458, 47.49348103198955], [7.024394386855231, 47.50421334191186], [6.985924997204884, 47.49152131286686], [6.998962818675516, 47.45229903121829], [6.970004495274878, 47.44688262940426], [6.940536510867674, 47.43337372140521], [6.9383780521299885, 47.40601986473863], [6.917565696040302, 47.40554258429283], [6.911280984371045, 47.3856550932385], [6.8853970779398175, 47.37459946804773], [6.87936818281023, 47.35839729641757], [6.919496443267278, 47.35536414476774], [6.994215518452339, 47.363057159308], [7.012120561775966, 47.37292288887178], [7.049718402997699, 47.360719992295074], [7.062207100094967, 47.34415745980239], [7.046203037401215, 47.326976713950984], [7.016140643996923, 47.31359873592356], [6.993126569921015, 47.29554511879603], [6.942895673773597, 47.287754384904254], [6.955208843014741, 47.244149772352195], [6.940725555973242, 47.231843645454894], [6.882433031143578, 47.201615584703326], [6.858349567867174, 47.164383477038406], [6.800236684357302, 47.128793351463806], [6.763777402656871, 47.11979205072034], [6.739920812240863, 47.1080561130741], [6.74109066784422, 47.091064413033465], [6.717835845806807, 47.08893991246636], [6.691621066187363, 47.06668923642061], [6.7140493259380465, 47.04912442357012], [6.699656601550015, 47.039041188281], [6.661624427517901, 47.02822165295931], [6.633742279087916, 46.99841408318843], [6.59318642597294, 46.991771506770114], [6.566568468914689, 46.98063803499442], [6.5188133537312165, 46.970857851315834], [6.49668554758685, 46.97418077120232], [6.446572766755816, 46.9341439731704], [6.432669440426171, 46.92860208537252], [6.4645840104267736, 46.89020943846434], [6.460055924791717, 46.85168246859297], [6.44262902075631, 46.83235109259498], [6.434826378361494, 46.801464616461466], [6.458567776224122, 46.788495437539005], [6.425917841439646, 46.75480272370325], [6.39507223431701, 46.74824769305675], [6.391779221321134, 46.73835933517175], [6.344803166577885, 46.711872179216], [6.285329368806656, 46.691241021954745], [6.227994158729884, 46.64830608201645], [6.175538722376977, 46.61413990223054], [6.127338291895881, 46.59030639234697], [6.110748015678899, 46.576313203446446], [6.1381085470292716, 46.55766039903405], [6.1564485471743415, 46.54546781327305], [6.112697563396416, 46.50963869187334], [6.096828928594163, 46.481206078469945], [6.073927085793577, 46.46394600628466], [6.085838952286885, 46.440997039522614], [6.06400848181829, 46.41622698893153], [6.029516385230691, 46.38681597881577], [5.983619269600146, 46.36236225578993], [5.94141074779852, 46.309447376328514], [5.918004636082658, 46.30919342038628], [5.908938421371525, 46.283951620059554], [5.894626274200642, 46.286605180505944], [5.878362837898188, 46.26923930243743], [5.849846074176259, 46.26206360332615], [5.76565366968616, 46.26829459697285], [5.725183003095842, 46.26072920479395], [5.715004075499846, 46.281794854191894], [5.714717731644379, 46.30876884774591], [5.6845818644582415, 46.31092471469043], [5.649352566100887, 46.33949973060812], [5.617647005041448, 46.32909642404822], [5.597401953530867, 46.29717016200506], [5.566359117801653, 46.29405393089148], [5.542037828826235, 46.27020190870743], [5.5202584619727855, 46.264154428816624], [5.4730553115738125, 46.26506376332347], [5.4568376845310524, 46.27447818647901], [5.475143359983399, 46.314983312313444], [5.466922894957274, 46.32326983579511], [5.437795113853317, 46.31511297122548], [5.425824019124199, 46.33893598335614], [5.401973542783007, 46.33904473846451], [5.373462288620209, 46.35223630468514], [5.375550503997551, 46.380228055197534], [5.341420750039618, 46.40179770821096], [5.298803013245869, 46.41268163222961], [5.319500329420964, 46.430811362520714], [5.310560613770375, 46.446766420719875], [5.25581668314639, 46.451923595866475], [5.215064143095116, 46.46835927312158], [5.201145471995378, 46.50821850614692], [5.172664602566099, 46.513447365613864], [5.137248163610305, 46.509322673438184], [5.107377093416356, 46.49191576160186], [5.056433075236103, 46.48392614751307], [5.027777929725955, 46.49358075779722], [5.004307716480809, 46.51041518184386], [4.935598865656449, 46.514228992728945], [4.915557341962093, 46.48894113481689], [4.915786922554027, 46.465410523692164], [4.891817622919295, 46.43991436571944], [4.8882077017045455, 46.40298160185766], [4.851457022538043, 46.35626925172072], [4.852756157390729, 46.328199775494426], [4.831827095028622, 46.29688694217226], [4.825956808265179, 46.27478753204555], [4.810994882268941, 46.25992151697563], [4.807756868341096, 46.23696871115128], [4.7945808953124605, 46.21831635025701], [4.780213475718984, 46.176677022719375], [4.757472202390895, 46.17225721411849], [4.730529789085251, 46.1783721277199], [4.7208781171109155, 46.19392061792661], [4.735252824806332, 46.210851459521535], [4.720630389105726, 46.22239538927804], [4.735773074768783, 46.234243689563726], [4.679555470888074, 46.25866738898982], [4.707543694868305, 46.2846591310526], [4.688792316232356, 46.30134017113633], [4.6546541224676705, 46.30348939899555], [4.617019082985369, 46.28062156129126], [4.618564521857389, 46.26479290298609], [4.58651066847238, 46.26869366799675], [4.557791734390365, 46.294551693366884], [4.537259095086993, 46.269909752755986], [4.504000511619177, 46.26712967638222], [4.488464517812633, 46.28799447923909], [4.458369104418381, 46.29697584037131], [4.405813600867752, 46.29606050757099], [4.392045244906183, 46.26302385998399], [4.388079599211451, 46.21978851671503], [4.362151387631787, 46.195596184477786], [4.3157404325049695, 46.17203342079279], [4.292313251311721, 46.17248235017095], [4.2818305705425415, 46.156597324529926], [4.257119428326002, 46.157287705187656], [4.257372590726873, 46.18473517832983], [4.224689888463, 46.177995310819746], [4.207908679923857, 46.194835796707316], [4.18453492610967, 46.188021124528625], [4.188443814996147, 46.17512895597164], [4.133393277727922, 46.17732129820146], [4.104090700200876, 46.19839492284894], [4.051958867651804, 46.181688397585496], [4.0304983004444725, 46.169772418692666], [3.9817875015959623, 46.176336440402444], [3.972545422490283, 46.20271202778806], [3.9135641774619283, 46.20692040053432], [3.8901323277345172, 46.21449064143864], [3.9094002908986636, 46.25772625699907], [3.8995333931893303, 46.27590543921817], [3.913568325901341, 46.29667714620525], [3.947724671420121, 46.303449323036666], [3.9501794500141676, 46.32060215408413], [3.9866257932147806, 46.3191937873956], [3.991608290169238, 46.36963488772235], [3.9772154801510964, 46.399224593839804], [3.996095243061049, 46.42738316091883], [3.988140931065446, 46.43545798547263], [3.9980416518372484, 46.46546757106011], [3.957937642803863, 46.48975562185932], [3.9189689867502246, 46.49606391967711], [3.8904705648097098, 46.48125092995184], [3.861780077410741, 46.492069790934515], [3.864628432284858, 46.509716167248044], [3.839759641886244, 46.51756472437794], [3.8340059039329697, 46.53113227681354], [3.8017563441985818, 46.51989955458826], [3.767456276915371, 46.53900905290684], [3.741846977514427, 46.539511127662195], [3.731542528360726, 46.54958181729057], [3.743101843011838, 46.56549988100001], [3.732377738592808, 46.60491072152218], [3.7138789586356697, 46.613996147529015], [3.712149662452129, 46.6336280503392], [3.6969523102437005, 46.66058216583623], [3.6689793976266167, 46.67350816429054], [3.651395777587073, 46.70281985671478], [3.6379005417614154, 46.707208771712054], [3.629423683496518, 46.74945902193754]]]}}]}'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "gdf.to_json()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py b/python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py index 449407c12..6b70832c2 100644 --- a/python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py +++ b/python/jupytergis_lab/jupytergis_lab/notebook/gis_document.py @@ -32,6 +32,8 @@ SourceType, ) +from jupytergis_lab.notebook import layer_wrapper + logger = logging.getLogger(__file__) @@ -240,6 +242,18 @@ def add_vectortile_layer( return self._add_layer(OBJECT_FACTORY.create_layer(layer, self)) + def get_source(self, source_id: str): + """ + Get a source by its ID. + + :param source_id: The ID of the source to retrieve. + :return: The source object. + """ + source = self._sources.get(source_id) + if source is None: + raise KeyError(f"No source found with ID: {source_id}") + return source + def add_geojson_layer( self, path: str | Path | None = None, @@ -314,6 +328,77 @@ def add_geojson_layer( return self._add_layer(OBJECT_FACTORY.create_layer(layer, self)) + def add_geojson_layer2( + self, + path: str | Path | None = None, + data: Dict | None = None, + name: str = "GeoJSON Layer", + opacity: float = 1, + logical_op: str | None = None, + feature: str | None = None, + operator: str | None = None, + value: Union[str, int, float] | None = None, + color_expr=None, + ): + if isinstance(path, Path): + path = str(path) + + if path is None and data is None: + raise ValueError("Cannot create a GeoJSON layer without data") + + if path is not None and data is not None: + raise ValueError("Cannot set GeoJSON layer data and path at the same time") + + parameters = {} + + if path is not None: + if path.startswith("http://") or path.startswith("https://"): + response = requests.get(path) + response.raise_for_status() + parameters["path"] = path + else: + with open(path, "r") as fobj: + parameters["data"] = json.load(fobj) + + if data is not None: + parameters["data"] = data + + source = { + "type": SourceType.GeoJSONSource, + "name": f"{name} Source", + "parameters": parameters, + } + + source_id = self._add_source(OBJECT_FACTORY.create_source(source, self)) + + layer = { + "type": LayerType.VectorLayer, + "name": name, + "visible": True, + "parameters": { + "source": source_id, + "color": color_expr, + "opacity": opacity, + }, + "filters": { + "appliedFilters": [ + {"feature": feature, "operator": operator, "value": value} + ], + "logicalOp": logical_op, + }, + } + print(layer) + + base_layer = OBJECT_FACTORY.create_layer(layer, self) + print("Base Layer:", base_layer) + wrapped_layer = layer_wrapper.CustomVectorWrapper(base_layer) + + print("cool", wrapped_layer) + + self._add_layer(wrapped_layer) + + return wrapped_layer + def add_image_layer( self, url: str, diff --git a/python/jupytergis_lab/jupytergis_lab/notebook/layer_wrapper.py b/python/jupytergis_lab/jupytergis_lab/notebook/layer_wrapper.py new file mode 100644 index 000000000..e27ad9a62 --- /dev/null +++ b/python/jupytergis_lab/jupytergis_lab/notebook/layer_wrapper.py @@ -0,0 +1,15 @@ +class CustomVectorWrapper: + def __init__(self, base_layer): + self._base_layer = base_layer + + def hello(self): + print("Hello world") + + def show_layer(self): + print("Showing layer:", self._base_layer.parameters) + + def toggle_visibility(self): + self._base_layer.visible = not self._base_layer.visible + + def __getattr__(self, name): + return getattr(self._base_layer, name)