Hi Everyone
Here is a simple question, how to plot several shapefiles in Jupyter notebook?
Thanks
Ming
If you're talking the built-in notebooks in Pro, check out arcgis.features.GeoAccessor().from_featureclass() to create a Spatially Enabled DataFrame of your shapefiles. Then it's as simple as calling plot on that object.
By creating a separate MapView first, you can plot your shapefiles onto the same map.
from arcgis.features import GeoAccessor from arcgis.widgets import MapView map1 = MapView() df1 = GeoAccessor().from_featureclass('C:/path-to-file/your-file.shp') df2 = GeoAccessor().from_featureclass('C:/path-to-file/your-file-2.shp') df1.spatial.plot(map1) df2.spatial.plot(map2)
Now, if you're not working in the default Pro python environment, I would be remiss if I didn't also mention GeoPandas, which is an excellent tool for making static maps that integrate cleanly with MatPlotLib, and is just as capable of reading shapefiles.
If I don't need my notebook maps to be interactive, I personally prefer to use it over the Spatially Enabled DataFrame. (Related: the SEDF has a from_geodataframe method to convert a GeoPandas GeoDataFrame into a SEDF, so if you need to get your data back into an Esri-friendly format, it's very easy to do so.)
You don't even need a jupyter notebook either
Arcpy shapes... viewing in Spyder - GeoNet, The Esri Community
It always seemed redundant to view spatial data in a notebook within Pro when you can just look at it in Pro if you have it already
😉
It gets a bit more complex, but take a look at the symbology section. You should be able to apply some of this to your map layer. I've a little less experience with that, however.
Thanks, It works for me.
How to only plot the outline of the polygon, without fill any colors?
I checked the options in here [https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.SpatialDataFrame.plot], seems no options are exist
ArcGIS Notebooks in ArcGIS Pro (2.7) - GeoNet, The Esri Community has some tips
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.