![]() The trick here is to make sure the result format type is set to JSON.Īrcpy. Either way, we are just going to call the same REST query inside Python using the urllib2 library. Once we have the service and layer, we can investigate the attributes and query options using the REST interface or just jump into Python. Convert results to a shapefile (or other feature class type)įor this example we will download US States from Esri’s ArcGIS Server sample server. ![]() Venn Diagram by Rob Jewitt Map Service to Shapefile using PythonĪlright, now that the legal stuff is out of the way - let’s get down to some coding! We are essentially just going to wrap 3 small steps into a python file: But if you really want to keep your data secure, please refer to the helpful venn diagram below. Possibly adding a note into the service description on intended use could also help. Oh, and if you are worried about someone downloading from your service: Best practice would be to secure the service, or at least limit the service functionality. Please make sure you have permission from the owner of the Data/Map Service, or have permission via a License (“Licence” in Canada) before running around downloading shapefiles from the internet. Why do I bring this up? Just because we can do something, doesn’t mean we should. Oh, and I’ve actually read the Canadian Copyright Act (some of it sunk in), done a few presentations on the topic, and deal with the subject at work on a daily basis. I’m not a lawyer - but I have watched many TV shows where someone else played one. UPDATE: Part 2 is now available - Map Service to Shapefile with Python Part 2 – Iteration Legal Schmegal (and a brief disclaimer) Is it legal? Not as easy as you would think! And before I get into this any further, there are also ways of doing this directly in ArcMap - but that wouldn’t be very Pythonic now would it. However, when I want to import an ArcMap document, I usually use the 'Import Map' button on the 'Insert' tab of an open ArcGIS Pro project.How easy/hard is it to extract a Map Service layer to Shapefile using Python? Not as hard as you would think. (Note that all of the above is entirely unrelated to importing. ![]() Use the 'Layout' link at the top to de-activate the map view and return to a normal layout view. This option will not actually open a separate map view, but will make the layout view temporarily behave like a map view, greying out all the other layout items.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |