0

I am familiarizing myself with the arcgis API for Python, and I would like to view the query I perform on a feature layer as a URL:

from arcgis.features import FeatureLayer
from arcgis.geometry import filters
# get the data from Boulder, CO and the UDFCD endpoints
city_lims = FeatureLayer("https://maps.bouldercolorado.gov/arcgis/rest/services/plan/CityLimits/MapServer/0")
udfcd = FeatureLayer("https://data.digitaldataservices.com/arcgis/rest/services/UrbanDrainage/UDFCDDataRoutineMaintenance/MapServer/0")

# create the spatial filter test
geom_test = filters.intersects(city_lims.properties.extent)

# perform the query, output to local state plane
cob_udfcd = udfcd.query(out_sr=2876,
                        geometry_filter=geom_test)
cob_udfcd # <-- returns a <FeatureSet>, I want a URL

The documentation mentions additional kwargs that I could enter, and I have a feeling herein lies my answer, but the problem is I have no idea what I would need to enter in order to spit out a URL, and the documentation doesn't offer up much more on kwargs:

Optional dict. Optional parameters that can be passed to the Query function. This will allow users to pass additional parameters not explicitly implemented on the function. A complete list of functions available is documented on the Query REST API.

How do I tell the ArcGIS API to return a URL which represents a query performed on a feature layer?

3
  • 1
    I believe the kwargs are referencing additional query parameters that you yourself could pass in to the URL aside from those supported by the function itself. Your question is an interesting one as the Python API I believe is taking your input parameters and creating a endpoint URL for use with the REST API. You could dive into the files for the acrgis and try and find what is occurring when you call .query on a FeatureLayer object. My guess is its using URLLIB or URLLIB3 to make the request. But I'm not that its possible to simply pass a parameter to return the endpoint URL for your request. Commented Sep 10, 2019 at 22:25
  • @F_Kellner thanks for your reply. I did try deep diving into the package contents and quickly got overwhelmed. I'll update if I do end up finding how arcgis actually executes the query, and whether one can pull the URL based on that info. Commented Sep 12, 2019 at 15:39
  • If you want to know what the Python API invokes, you ought to just review the REST API, then send the HTTPS requests directly with requests. Commented May 1 at 16:37

1 Answer 1

0

To do this you will have to list the parameter from the rest API followed by equal and a string of your inputs, for example:

flayer.query(geometry='30, 14, 35, 20')

Your Answer

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.