2

I have access to a ArcGIS REST API service running on a standalone, unfederated ArcGIS Server. (Not AGOL or ArcGIS Enteprise) ie (https://xxxx.xxxxx.com/arcgis/rest/services/xxxxxx/xxxxMap/MapServer)

Is there any way to consume the REST API services like MapServers, ImageServers using ArcGIS's Python API?

Also, I am working in a secured environment with no internet access. Using MapImageLayer from ArcGIS's Python API forces a GIS object as a parameter by default. And that GIS object calls out to www.arcgis.com for anonymous authentication.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked May 18, 2021 at 15:18

1 Answer 1

2

It is possible to get to the feature services in a standalone server by using the arcgis.server.Server class.

See the doc and tech article here:

Here is a snippet to get access to a FeatureLayerCollection directly from the server instead of the portal.

from arcgis import *
from arcgis.gis import server
server_base_url = "https://servername.esri.com"
gis_server = server.Server(url=f"{server_base_url}/web_adaptor/admin",
 token_url=f"{server_base_url}/web_adaptor/tokens/generateToken",
 username="username",
 password="pass.word")
content_dir = gis_server.content
service = content_dir.get("lsa_testing_feet")
print(type(service))
>>> <class 'arcgis.features.layer.FeatureLayerCollection'>
answered Aug 4, 2021 at 18:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.