Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Query an ArcGIS feature server?
#1
The following code was used earlier to query data and I got the URL by inspecting a page element with a table in it. So I figured why not try to figure out how this works so I can use it on other websites to pull large amounts of information. But I'm having trouble.

data_url = 'http://sagisservices.thempc.org/saint/rest/services/OpenData/Parcels/MapServer/0/query?objectIds=1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%2C44%2C45%2C46%2C47%2C48%2C49%2C50%2C51%2C52%2C53%2C54%2C55%2C56%2C57%2C58%2C59%2C60%2C61%2C62%2C63%2C64%2C65%2C66%2C67%2C68%2C69%2C70%2C71%2C72%2C73%2C74%2C75%2C76%2C77%2C78%2C79%2C80%2C81%2C82%2C83%2C84%2C85%2C86%2C87%2C88%2C89%2C90%2C91%2C92%2C93%2C94%2C95%2C96%2C97%2C98%2C99%2C100&outFields=*&returnGeometry=false&orderByFields=&f=json'
response = requests.get(data_url)
response.raise_for_status()
data = response.json()
So I just figured out that I can access a webpage with a list of (featureservers) for ARCGIS here: https://services1.arcgis.com/O1JpcwDW8sj...t/services

What am I actually doing when I send a Query that looks like this to the server:
data_url = 'https://services1.arcgis.com/O1JpcwDW8sjYuddV/ArcGIS/rest/services/2015_Feature_241/FeatureServer/0/query?objectIds=1%2C2&f=json'
response = requests.get(data_url)
response.raise_for_status()
data = response.json()
I know that /0 is the index to access the first feature 2015_feature_241,
I know that /query?objectIds is telling it which information I want,
I know that f=json formats the output to json.

What I don't know is how to pull all the information for feature 2015_feature_241. The only reason I put in objectIds=1%2C2 is because I saw that it worked for my previous example but I dont know what it is doing. Could anyone point me in the correct direction to read up on the syntax for querying?
Reply


Messages In This Thread
Query an ArcGIS feature server? - by SimpleGuy - Aug-17-2017, 08:02 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020