{ "cells": [ { "cell_type": "markdown", "id": "8165d33c-97f9-4c13-907b-91be36951c95", "metadata": {}, "source": [ "# Connect to and get data from ArcGIS REST services\n", "O.Kaufmann, 2023." ] }, { "cell_type": "code", "execution_count": 1, "id": "e1651677-3ab3-46e3-a8a2-dd0724af4666", "metadata": {}, "outputs": [], "source": [ "from geometron.plot import basemaps\n", "from geometron.utils.url import url_open_with_retry, http_request, url_request_string\n", "from geometron.utils.str import remove_accents\n", "from geometron.utils.geoservices import arcgis_rest_services_directory, esri_rest_server_request, esri_rest_server_metadata\n", "import urllib\n", "import json\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "d19fd989-41ed-4da9-bad6-e9a26818cc90", "metadata": {}, "outputs": [], "source": [ "#server = 'https://geoservices.wallonie.be/arcgis/rest/services/'\n", "server = 'https://ags.geo.api.vlaanderen.be/arcgis/rest/services/' " ] }, { "cell_type": "markdown", "id": "5f2274ee-9efb-4c75-b368-d24e7011bd21", "metadata": {}, "source": [ "## Retrieve a dataframe describing available services from an ESRI REST server using a keyword" ] }, { "cell_type": "code", "execution_count": 3, "id": "82750fda-c3b9-45ed-a2ec-84a080fdc47d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/0\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/1\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/2\n", "The read operation timed out\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/3\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/4\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/5\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/6\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/7\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/8\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/9\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/10\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/11\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/12\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/13\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/14\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/15\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/16\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/17\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/18\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/19\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/20\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/21\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/22\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/23\n", "https://ags.geo.api.vlaanderen.be/arcgis/rest/services//vlm/MapServer/24\n" ] }, { "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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
folderservicesservice_typeid_layernamealiaslayer_typeurl
0vlmMapServer0beheergebiedenbeheergebiedenGroup Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
1vlmMapServer1behgebgraslandbehgebgraslandFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
2vlmMapServer2behgebwaterkwalbehgebwaterkwalFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
3vlmMapServer3behgebweidevogelbehgebweidevogelFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
4vlmMapServer4behgebakkervogelbehgebakkervogelFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
5vlmMapServer5behgebnat2000behgebnat2000Feature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
6vlmMapServer6gebnitgebnitFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
7vlmMapServer7gebnit19gebnit19Feature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
8vlmMapServer8gebnit21gebnit21Feature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
9vlmMapServer9gebnit23gebnit23Feature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
10vlmMapServer10natuurinrichtingnatuurinrichtingGroup Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
11vlmMapServer11rvvnatinrprjrvvnatinrprjFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
12vlmMapServer12natinrprjnatinrprjFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
13vlmMapServer13ruilverkavelingruilverkavelingGroup Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
14vlmMapServer14rvkinderminnervkinderminneFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
15vlmMapServer15rvvrvkgiwrvvrvkgiwFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
16vlmMapServer16rvkgrinfrawerkenrvkgrinfrawerkenFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
17vlmMapServer17rvvrvkukwrvvrvkukwFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
18vlmMapServer18rvkkrachtwetrvkkrachtwetFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
19vlmMapServer19landinrichtinglandinrichtingGroup Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
20vlmMapServer20rvvlandinrplrvvlandinrplFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
21vlmMapServer21landinrpllandinrplFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
22vlmMapServer22vastgestlandinrprjvastgestlandinrprjFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
23vlmMapServer23landinrinondlandinrinondFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
24vlmMapServer24fyssystfyssystFeature Layerhttps://ags.geo.api.vlaanderen.be/arcgis/rest/...
\n", "
" ], "text/plain": [ " folder services service_type id_layer name \\\n", "0 vlm MapServer 0 beheergebieden \n", "1 vlm MapServer 1 behgebgrasland \n", "2 vlm MapServer 2 behgebwaterkwal \n", "3 vlm MapServer 3 behgebweidevogel \n", "4 vlm MapServer 4 behgebakkervogel \n", "5 vlm MapServer 5 behgebnat2000 \n", "6 vlm MapServer 6 gebnit \n", "7 vlm MapServer 7 gebnit19 \n", "8 vlm MapServer 8 gebnit21 \n", "9 vlm MapServer 9 gebnit23 \n", "10 vlm MapServer 10 natuurinrichting \n", "11 vlm MapServer 11 rvvnatinrprj \n", "12 vlm MapServer 12 natinrprj \n", "13 vlm MapServer 13 ruilverkaveling \n", "14 vlm MapServer 14 rvkinderminne \n", "15 vlm MapServer 15 rvvrvkgiw \n", "16 vlm MapServer 16 rvkgrinfrawerken \n", "17 vlm MapServer 17 rvvrvkukw \n", "18 vlm MapServer 18 rvkkrachtwet \n", "19 vlm MapServer 19 landinrichting \n", "20 vlm MapServer 20 rvvlandinrpl \n", "21 vlm MapServer 21 landinrpl \n", "22 vlm MapServer 22 vastgestlandinrprj \n", "23 vlm MapServer 23 landinrinond \n", "24 vlm MapServer 24 fyssyst \n", "\n", " alias layer_type \\\n", "0 beheergebieden Group Layer \n", "1 behgebgrasland Feature Layer \n", "2 behgebwaterkwal Feature Layer \n", "3 behgebweidevogel Feature Layer \n", "4 behgebakkervogel Feature Layer \n", "5 behgebnat2000 Feature Layer \n", "6 gebnit Feature Layer \n", "7 gebnit19 Feature Layer \n", "8 gebnit21 Feature Layer \n", "9 gebnit23 Feature Layer \n", "10 natuurinrichting Group Layer \n", "11 rvvnatinrprj Feature Layer \n", "12 natinrprj Feature Layer \n", "13 ruilverkaveling Group Layer \n", "14 rvkinderminne Feature Layer \n", "15 rvvrvkgiw Feature Layer \n", "16 rvkgrinfrawerken Feature Layer \n", "17 rvvrvkukw Feature Layer \n", "18 rvkkrachtwet Feature Layer \n", "19 landinrichting Group Layer \n", "20 rvvlandinrpl Feature Layer \n", "21 landinrpl Feature Layer \n", "22 vastgestlandinrprj Feature Layer \n", "23 landinrinond Feature Layer \n", "24 fyssyst Feature Layer \n", "\n", " url \n", "0 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "1 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "2 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "3 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "4 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "5 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "6 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "7 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "8 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "9 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "10 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "11 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "12 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "13 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "14 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "15 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "16 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "17 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "18 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "19 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "20 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "21 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "22 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "23 https://ags.geo.api.vlaanderen.be/arcgis/rest/... \n", "24 https://ags.geo.api.vlaanderen.be/arcgis/rest/... " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "arcgis_rest_services_directory(server, keyword='vlm')" ] }, { "cell_type": "markdown", "id": "096674f2-4d0b-4cba-b19f-6f06b3f6180f", "metadata": {}, "source": [ "## Create a request to an ESRI REST server and display the reply as a json" ] }, { "cell_type": "code", "execution_count": 4, "id": "5f965325-4337-4eb5-9732-031c297e416f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\u001b[0;31mSignature:\u001b[0m\n", "\u001b[0mesri_rest_server_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mhost\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mcontext\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'arcgis'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mfolder\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mservice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mservice_type\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mlayer\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mresource\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0moperation\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m''\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mparameter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'f'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'pjson'\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mprotocol\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'https'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mDocstring:\u001b[0m\n", "Creates a request to an ESRI REST API server\n", "\n", "Parameters\n", "----------\n", "verbose\n", "protocol\n", "parameter\n", "operation\n", "resource\n", "layer\n", "service_type\n", "service\n", "folder\n", "context\n", "host: str\n", " host address\n", "\n", "Returns\n", "-------\n", " https:////rest/services//////?\n", "\u001b[0;31mFile:\u001b[0m ~/PycharmProjects/geometron/geometron/utils/geoservices.py\n", "\u001b[0;31mType:\u001b[0m function" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "esri_rest_server_request?" ] }, { "cell_type": "code", "execution_count": 5, "id": "7e256d6d-addc-49ab-a456-dad02540ecfe", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "url:\n", "https://geoservices.wallonie.be/arcgis/rest/services/IMAGERIE/ORTHO_2020/MapServer/?f=pjson\n", "\n" ] } ], "source": [ "r = esri_rest_server_request('geoservices.wallonie.be', folder='IMAGERIE', service='ORTHO_2020', service_type='MapServer', verbose=True)" ] }, { "cell_type": "code", "execution_count": 6, "id": "ac7c46cd-d7dd-44e8-9f25-73247141553c", "metadata": {}, "outputs": [], "source": [ "resp = url_open_with_retry(r)" ] }, { "cell_type": "code", "execution_count": 7, "id": "93da9f3f-1dc1-40c8-9434-652149ac20a7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "b'{\\n \"currentVersion\": 10.51,\\n \"serviceDescription\": \"Ce service de visualisation REST permet de consulter l\\'image orthorectifiée et mosaïquée couvrant l\\'entièreté du territoire wallon à une résolution de 25 cm pour l\\'année 2020.\\\\nPour tout complément d\\'informations, veuillez consulter https://geoportail.wallonie.be/catalogue/cf1f6fae-d938-42ba-8e2c-18de5d450122.html\",\\n \"mapName\": \"Layers\",\\n \"description\": \"\",\\n \"copyrightText\": \"SPW\",\\n \"supportsDynamicLayers\": true,\\n \"layers\": [\\n {\\n \"id\": 0,\\n \"name\": \"ORTHO_2020\",\\n \"parentLayerId\": -1,\\n \"defaultVisibility\": true,\\n \"subLayerIds\": null,\\n \"minScale\": 0,\\n \"maxScale\": 0\\n }\\n ],\\n \"tables\": [],\\n \"spatialReference\": {\\n \"wkid\": 102199,\\n \"latestWkid\": 3812\\n },\\n \"singleFusedMapCache\": false,\\n \"initialExtent\": {\\n \"xmin\": 495814.35533628846,\\n \"ymin\": 484814.15198506153,\\n \"xmax\": 823759.8872449,\\n \"ymax\": 703125.8034499779,\\n \"spatialReference\": {\\n \"wkid\": 102199,\\n \"latestWkid\": 3812\\n }\\n },\\n \"fullExtent\": {\\n \"xmin\": 542000.7987416779,\\n \"ymin\": 519988.6172621446,\\n \"xmax\": 796016.2987416779,\\n \"ymax\": 668017.8672621446,\\n \"spatialReference\": {\\n \"wkid\": 102199,\\n \"latestWkid\": 3812\\n }\\n },\\n \"minScale\": 0,\\n \"maxScale\": 0,\\n \"units\": \"esriMeters\",\\n \"supportedImageFormatTypes\": \"PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP\",\\n \"documentInfo\": {\\n \"Title\": \"ORTHO_2020\",\\n \"Author\": \"\",\\n \"Comments\": \"Ce service de visualisation REST permet de consulter l\\'image orthorectifi\\xc3\\xa9e et mosa\\xc3\\xafqu\\xc3\\xa9e couvrant l\\'enti\\xc3\\xa8ret\\xc3\\xa9 du territoire wallon \\xc3\\xa0 une r\\xc3\\xa9solution de 25 cm pour l\\'ann\\xc3\\xa9e 2020.\\\\nPour tout compl\\xc3\\xa9ment d\\'informations, veuillez consulter http://geoportail.wallonie.be/catalogue/17dab011-b21a-486c-b602-6ec141f1f059.html\\\\n\",\\n \"Subject\": \"Ce service de visualisation REST permet de consulter l\\'image orthorectifiée et mosaïquée couvrant l\\'entièreté du territoire wallon pour l\\'année 2020.\",\\n \"Category\": \"\",\\n \"AntialiasingMode\": \"None\",\\n \"TextAntialiasingMode\": \"Force\",\\n \"Keywords\": \"ortho,orthophoto,orthophotoplan,vue aérienne,image aérienne,IR,infra-rouge,ortho_2020,orthoimagerie,infrarouge,REST\"\\n },\\n \"capabilities\": \"Map,Query,Data\",\\n \"supportedQueryFormats\": \"JSON, AMF, geoJSON\",\\n \"exportTilesAllowed\": false,\\n \"datumTransformations\": [\\n {\\n \"geoTransforms\": [\\n {\\n \"wkid\": 108001,\\n \"latestWkid\": 1241,\\n \"transformForward\": true,\\n \"name\": \"NAD_1927_To_NAD_1983_NADCON\"\\n }\\n ]\\n },\\n {\\n \"geoTransforms\": [\\n {\\n \"wkid\": 108001,\\n \"latestWkid\": 1241,\\n \"transformForward\": false,\\n \"name\": \"NAD_1927_To_NAD_1983_NADCON\"\\n }\\n ]\\n },\\n {\\n \"geoTransforms\": [\\n {\\n \"wkid\": 1609,\\n \"latestWkid\": 1609,\\n \"transformForward\": true,\\n \"name\": \"Belge_1972_To_WGS_1984_1\"\\n }\\n ]\\n },\\n {\\n \"geoTransforms\": [\\n {\\n \"wkid\": 1609,\\n \"latestWkid\": 1609,\\n \"transformForward\": false,\\n \"name\": \"Belge_1972_To_WGS_1984_1\"\\n }\\n ]\\n }\\n ],\\n \"supportsDatumTransformation\": true,\\n \"maxRecordCount\": 1000,\\n \"maxImageHeight\": 4096,\\n \"maxImageWidth\": 4096,\\n \"supportedExtensions\": \"WMSServer\"\\n}'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "resp.read()" ] }, { "cell_type": "markdown", "id": "fbea9800-08c7-4fb1-93b5-c8dda2bc3916", "metadata": {}, "source": [ "## Retrieve metadata from an ESRI REST server" ] }, { "cell_type": "code", "execution_count": 7, "id": "de968326-4ef8-44ec-af52-32c42f21eeab", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "url:\n", "https://geoservices.wallonie.be/arcgis/rest/services/IMAGERIE/ORTHO_2020/MapServer/?f=pjson\n", "\n" ] }, { "data": { "text/plain": [ "{'currentVersion': 10.51,\n", " 'serviceDescription': \"Ce service de visualisation REST permet de consulter l'image orthorectifiée et mosaïquée couvrant l'entièreté du territoire wallon à une résolution de 25 cm pour l'année 2020.\\nPour tout complément d'informations, veuillez consulter https://geoportail.wallonie.be/catalogue/cf1f6fae-d938-42ba-8e2c-18de5d450122.html\",\n", " 'mapName': 'Layers',\n", " 'description': '',\n", " 'copyrightText': 'SPW',\n", " 'supportsDynamicLayers': True,\n", " 'layers': [{'id': 0,\n", " 'name': 'ORTHO_2020',\n", " 'parentLayerId': -1,\n", " 'defaultVisibility': True,\n", " 'subLayerIds': None,\n", " 'minScale': 0,\n", " 'maxScale': 0}],\n", " 'tables': [],\n", " 'spatialReference': {'wkid': 102199, 'latestWkid': 3812},\n", " 'singleFusedMapCache': False,\n", " 'initialExtent': {'xmin': 495814.35533628846,\n", " 'ymin': 484814.15198506153,\n", " 'xmax': 823759.8872449,\n", " 'ymax': 703125.8034499779,\n", " 'spatialReference': {'wkid': 102199, 'latestWkid': 3812}},\n", " 'fullExtent': {'xmin': 542000.7987416779,\n", " 'ymin': 519988.6172621446,\n", " 'xmax': 796016.2987416779,\n", " 'ymax': 668017.8672621446,\n", " 'spatialReference': {'wkid': 102199, 'latestWkid': 3812}},\n", " 'minScale': 0,\n", " 'maxScale': 0,\n", " 'units': 'esriMeters',\n", " 'supportedImageFormatTypes': 'PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP',\n", " 'documentInfo': {'Title': 'ORTHO_2020',\n", " 'Author': '',\n", " 'Comments': \"Ce service de visualisation REST permet de consulter l'image orthorectifiée et mosaïquée couvrant l'entièreté du territoire wallon à une résolution de 25 cm pour l'année 2020.\\nPour tout complément d'informations, veuillez consulter http://geoportail.wallonie.be/catalogue/17dab011-b21a-486c-b602-6ec141f1f059.html\\n\",\n", " 'Subject': \"Ce service de visualisation REST permet de consulter l'image orthorectifiée et mosaïquée couvrant l'entièreté du territoire wallon pour l'année 2020.\",\n", " 'Category': '',\n", " 'AntialiasingMode': 'None',\n", " 'TextAntialiasingMode': 'Force',\n", " 'Keywords': 'ortho,orthophoto,orthophotoplan,vue aérienne,image aérienne,IR,infra-rouge,ortho_2020,orthoimagerie,infrarouge,REST'},\n", " 'capabilities': 'Map,Query,Data',\n", " 'supportedQueryFormats': 'JSON, AMF, geoJSON',\n", " 'exportTilesAllowed': False,\n", " 'datumTransformations': [{'geoTransforms': [{'wkid': 108001,\n", " 'latestWkid': 1241,\n", " 'transformForward': True,\n", " 'name': 'NAD_1927_To_NAD_1983_NADCON'}]},\n", " {'geoTransforms': [{'wkid': 108001,\n", " 'latestWkid': 1241,\n", " 'transformForward': False,\n", " 'name': 'NAD_1927_To_NAD_1983_NADCON'}]},\n", " {'geoTransforms': [{'wkid': 1609,\n", " 'latestWkid': 1609,\n", " 'transformForward': True,\n", " 'name': 'Belge_1972_To_WGS_1984_1'}]},\n", " {'geoTransforms': [{'wkid': 1609,\n", " 'latestWkid': 1609,\n", " 'transformForward': False,\n", " 'name': 'Belge_1972_To_WGS_1984_1'}]}],\n", " 'supportsDatumTransformation': True,\n", " 'maxRecordCount': 1000,\n", " 'maxImageHeight': 4096,\n", " 'maxImageWidth': 4096,\n", " 'supportedExtensions': 'WMSServer'}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "host = 'geoservices.wallonie.be'\n", "folder = 'IMAGERIE'\n", "service = 'ORTHO_2020'\n", "esri_rest_server_metadata(host, folder=folder, service=service)" ] }, { "cell_type": "code", "execution_count": null, "id": "c145afbe-5452-4eaf-8275-2c045c3d3457", "metadata": {}, "outputs": [], "source": [] } ], "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.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }