For the map in question, the data owners have a dedicated Data Request Form and a Code of Conduct you must agree to. You should put in some effort looking around their website and contact pages to try and see who maintains the data, what, if any, terms and conditions are in place, etc. There is also a chance that the data owner is happy to share their data. If there isn't a big button that says "download this data", that's often an intentional choice by the data owner. While the data may seem "public" because we can see it on a web map, scraping the data itself is often a violation of a website or organization's Terms of Service. You might need to explicitly tell it what the data types are, though, and that could be tricky inside of a loop if the CSVs don't have identical schemas.įirst of all, you really ought to be careful with this sort of thing. "fs.sdf" gets you the FeatureSet as a DataFrame, and from there, you can use the spatial.
I like using DataFrames when I can, but it can be irritating if the data's not just so. Writing the output of that to a file could then be used with JSON to Feature Class. To JSON / GeoJSON: you can call the property " to_geojson" or " to_json" on the FeatureSet. Simply append "fs.save('your-file-path', l)" inside the for-loop. With access to arcpy, you can call save on a FeatureSet. We're still one line short of this code giving you any kind of output, but that depends where you're running your code. Anyhow, it's less elegant, but this still works: The JSON says that these layers support using query, but I can't seem to get it to work. Using the arcgis module in Python, we can pull a list of layers for the map, then interact with each to convert the contents to friendlier formats. That's unfortunate, as we can't directly query a service URL for those. Looking at it, it's clear the data we want is in a series of separate CSV files added to the web map in AGOL, but not published as a standalone service. So, we've got the web map definition JSON. Knowing now that this is for academic research, and that you're clearly well aware of your legal "footing", so to speak, I certainly feel more comfortable elaborating. I've known a few projects that got tanked due to a Data Owner taking issue with how they obtained / used their data, so my default response to getting data in a way that isn't specifically and explicitly permitted is perhaps overly cautious. I wasn't talking about ethics so much as basic CYA. That's good to know, especially the link you shared!