<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extracting data from a public web layer in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610887#M2984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may need to do a `git pull` in the GitHub repo to pull the latest version of the code.&amp;nbsp; You'll also want to change the output kmz path and name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Feb 2019 14:36:26 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2019-02-11T14:36:26Z</dc:date>
    <item>
      <title>Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610881#M2978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if it's the right place to ask this question but here it is. There is an open-access GIS that hosts some data I'm interested in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.wwf.bg/mobilz/en/"&gt;https://gis.wwf.bg/mobilz/en/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For some reason English and Bulgarian version have different layer structure but anyways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm fairly new to ArcGIS (and GIS in general) and it's probably an overkill for my needs at this point so I'd like to start with something simple - extract data from "Protected areas in Bulgaria" and "Protected zones Natura 2000" sublayers and have each sublayer in a separate file - preferably KMZ or GPX. I'm aware some metadata will be lost but I don't care about it at this point. Not sure how much will be lost when going to KMZ but for GPX polygons will have to be converted to tracks which is fine for me (as long as I can identify the original object name from the track name). Accuracy is of little importance as it's good enough to know where object boundaries roughly lie on the map. Also, I'm trying to automate this extraction in a Linux shell script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Couple of things I tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Retrieving (questionably) all objects within a layer&amp;nbsp;via the rest API:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wget -O - "https://gis.trimbul.com/arcgis/rest/services/trees/zashtiteniteritorii/MapServer/find?f=json&amp;amp;searchText=резерват&amp;amp;layers=0"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, two issues with this approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;searchText is mandatory. While I expect certain words to be present in every layer it's not a foolproof solution.&lt;/LI&gt;&lt;LI&gt;I don't understand the result that I get. First object for example:&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;{"results":[{"layerId":0,"layerName":"Резервати","displayFieldName":"Name_ENG","foundFieldName":"Type_Name_","value":"Резерват Вълчи дол","attributes":{"FID":"0","Shape":"Polygon","Name_ENG":"Valchi Dol","SITE_CODE":"176839","DESIG_ABBR":"BG01","area":"767","Name_BG":"Вълчи дол","FID_1":"0","Type_Name_":"Резерват Вълчи дол","Purpose_BG":"Целта е да опази единствената в България колония на белоглави лешояди, както и местообитания на други редки и застрашени видове птици.","NAME_BG_1":" ","LINK":" ","NAME_BG_12":" ","LINK_1":" "},"geometryType":"esriGeometryPolygon","geometry":{"rings":[[[2848916.5844476218,5099207.6745737931],[2848891.1791850836,5099275.1015510419],[2848841.0894904374,5099379.3485733839],[2848795.297296484,5099446.2420776887]...&lt;/PRE&gt;&lt;P&gt;Comma-separated values must be the GPS coordinates of the polygon points but they are in a coordinate system that means nothing to me. If I get those in WGS-84 I might be able to create a GPX file from the output and live with the limitation of this method. Fetching the data via REST API is my number one target as it's easy to process it on CLI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;Importing the web layer to ArcGIS Online and exporting the data in KMZ. Doesn't happen due to lack of granted privileges on the server side I guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Trying the Rest API Python package created by &lt;A href="https://community.esri.com/migrated-users/31388"&gt;Caleb Mackey&lt;/A&gt;‌ but hit a few brickwalls. Python is not in my good skills list unfortunately. I'm on Ubuntu 18.04 which has limited support for Python 2 as far as I'm aware so this might be a problem too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.esri.com/people/Caleb1987/blog/2015/05/08/restapi-python-package"&gt;https://community.esri.com/people/Caleb1987/blog/2015/05/08/restapi-python-package&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Not tested yet - fetching data in a desktop product (ArcMap would be the correct one I guess) and trying to extract it there. Still waiting for my license. This might be useful if I ever get skilled enough to consolidate all my data in an ArcGIS software and&amp;nbsp;make it public&amp;nbsp;it via a web GIS one day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anywhere, my theory is - if a browser can fetch and visualize some data there must be a way to extract it and make use of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2019 18:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610881#M2978</guid>
      <dc:creator>StefanStefanov</dc:creator>
      <dc:date>2019-02-08T18:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610882#M2979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can accomplish this easily with &lt;A href="https://github.com/Bolton-and-Menk-GIS/restapi" rel="nofollow noopener noreferrer" target="_blank"&gt;restapi&lt;/A&gt;.&amp;nbsp; I did just push up a few changes, so may want to do a `git pull` first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get a kmz, I just did the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;url &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://gis.trimbul.com/arcgis/rest/services/trees/zashtiteniteritorii/MapServer/0'&lt;/SPAN&gt;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; restapi&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapServiceLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;url&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
where &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; u&lt;SPAN class="string token"&gt;"Type_Name_ LIKE '%резерват%'"&lt;/SPAN&gt;
out_kmz &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'D:\Users\calebma\Desktop\tester.kmz'&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# change this to your output path for kmz&lt;/SPAN&gt;
fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;where&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;where&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; f&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'kmz'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; kmz&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;out_kmz&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:08:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610882#M2979</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T02:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610883#M2980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using ArcGIS Desktop, you can use the following tool to download the data as a feature class:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/docs/DOC-6496"&gt;Download ArcGIS Online Feature Service or ArcGIS Server Feature/Map Service&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/436917_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Feb 2019 18:54:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610883#M2980</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2019-02-08T18:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610884#M2981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should be able to achieve the desired result using only &lt;EM&gt;wget:&lt;/EM&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;wget "https://gis.trimbul.com/arcgis/rest/services/trees/zashtiteniteritorii/MapServer/0/query?where=Type_Name_+LIKE+'%резерват%'&amp;amp;f=kmz" -O test.kmz‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 04:38:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610884#M2981</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2019-02-11T04:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610885#M2982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Holy cow, thanks a bunch guys! All your answers are useful to me cause now I got greedy and want this this stuff both dynamically loaded in a desktop GIS and as an offline version to use when no Internet connection is present &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp;!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 08:15:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610885#M2982</guid>
      <dc:creator>StefanStefanov</dc:creator>
      <dc:date>2019-02-11T08:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610886#M2983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Caleb, am I missing something here, perhaps a library I have not imported?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import os&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; import restapi&lt;BR /&gt;open source: False&lt;BR /&gt;/usr/local/lib/python2.7/dist-packages/restapi/common_types.py:61: UserWarning: No Arcpy found, some limitations in functionality may apply.&lt;BR /&gt; warnings.warn('No Arcpy found, some limitations in functionality may apply.')&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; url = 'https://gis.trimbul.com/arcgis/rest/services/trees/zashtiteniteritorii/MapServer/0'&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; lyr = restapi.MapServiceLayer(url)&lt;BR /&gt;where = u"Type_Name_ LIKE '%резерват%'"&lt;BR /&gt;out_kmz = r'D:\Users\calebma\Desktop\tester.kmz' # change this to your output path for kmz&lt;BR /&gt;fs = lyr.query(where=where, f='kmz', kmz=out_kmz)&amp;gt;&amp;gt;&amp;gt; where = u"Type_Name_ LIKE '%резерват%'"&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; out_kmz = r'D:\Users\calebma\Desktop\tester.kmz' # change this to your output path for kmz&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; fs = lyr.query(where=where, f='kmz', kmz=out_kmz)&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt; File "/usr/local/lib/python2.7/dist-packages/restapi/common_types.py", line 1000, in query&lt;BR /&gt; r = self.request(query_url, params)&lt;BR /&gt; File "/usr/local/lib/python2.7/dist-packages/restapi/rest_utils.py", line 590, in request&lt;BR /&gt; return do_post(*args, **kwargs)&lt;BR /&gt; File "/usr/local/lib/python2.7/dist-packages/restapi/rest_utils.py", line 186, in do_post&lt;BR /&gt; _json = r.json()&lt;BR /&gt; File "/usr/local/lib/python2.7/dist-packages/restapi/requests/models.py", line 866, in json&lt;BR /&gt; return complexjson.loads(self.text, **kwargs)&lt;BR /&gt; File "/usr/lib/python2.7/json/__init__.py", line 339, in loads&lt;BR /&gt; return _default_decoder.decode(s)&lt;BR /&gt; File "/usr/lib/python2.7/json/decoder.py", line 364, in decode&lt;BR /&gt; obj, end = self.raw_decode(s, idx=_w(s, 0).end())&lt;BR /&gt; File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode&lt;BR /&gt; raise ValueError("No JSON object could be decoded")&lt;BR /&gt;ValueError: No JSON object could be decoded&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 08:17:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610886#M2983</guid>
      <dc:creator>StefanStefanov</dc:creator>
      <dc:date>2019-02-11T08:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610887#M2984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may need to do a `git pull` in the GitHub repo to pull the latest version of the code.&amp;nbsp; You'll also want to change the output kmz path and name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 14:36:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610887#M2984</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-02-11T14:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610888#M2985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I was half asleep when I tried this &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; Of course your code pulls the data correctly. It has the added benefit over the wget solution to fetch correctly the reserve names. To be fair most of the methods I tried couldn't export the names properly in a KMZ/KML.&lt;BR /&gt;&lt;BR /&gt;It's a pity I can't "mark as correct" multiple answers as all your suggestions guys give the desired results. Thank you so much again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:42:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/610888#M2985</guid>
      <dc:creator>StefanStefanov</dc:creator>
      <dc:date>2019-02-11T16:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting data from a public web layer</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/1001780#M3614</link>
      <description>&lt;P&gt;Dear Stefan,&lt;/P&gt;&lt;P&gt;Instead loading our servers with your bulk requests and downloading data that you are not authorized for, easier is to ask for them. Many people try to get them and then sell them via mobile apps they develop. We are were informed about these activities in Bulgaria already.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, administrators here to delete this topic.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;WWF Forest Team&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 16:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/extracting-data-from-a-public-web-layer/m-p/1001780#M3614</guid>
      <dc:creator>Forest_TeamTeam</dc:creator>
      <dc:date>2020-11-16T16:18:22Z</dc:date>
    </item>
  </channel>
</rss>

