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.

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'>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.