<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Mapping local shapefile overlayed with Living Atlas layer in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598421#M11247</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/685546"&gt;@HieuTran12&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Are you using a Jupyter Notebook in ArcGIS Pro?&lt;/P&gt;&lt;P&gt;Try this...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
import pandas as pd

## Access ArcGIS Online
gis = GIS("home")

## path to the shapefile
shp = r"C:\PATH\TO\MY.shp"

## get the item from Living Atlas
lecz = gis.content.get("87f875a0e4ac4400bad9063c18520f9a")

## get the shp as df
df = pd.DataFrame.spatial.from_featureclass(location=shp, sr=3857)

## convert the df to a feature collection
fc = df.spatial.to_feature_collection(name = "PR Block 20202", sanitize_columns="True")

## create a map widget
map_widget = gis.map("Puerto Rico")

## add the layers
map_widget.content.add(lecz.layers[0])
map_widget.content.add(fc)

## display the map
map_widget
&lt;/LI-CODE&gt;&lt;P&gt;Here's my example with counties in Ireland.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Clubdebambos_0-1742804993671.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128527i3AC132F9EF4253E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1742804993671.png" alt="Clubdebambos_0-1742804993671.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
    <pubDate>Mon, 24 Mar 2025 08:31:43 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2025-03-24T08:31:43Z</dc:date>
    <item>
      <title>Mapping local shapefile overlayed with Living Atlas layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598365#M11245</link>
      <description>&lt;P&gt;I've been struggling with mapping the overlaying of local shapefile with Living Atlas layers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to map it on the AGOL UI, but with Python API I'm stuck.&lt;/P&gt;&lt;P&gt;My approach is converted the shapefile to spatial dataframe enabled and plot to the map widget where is the Living Atlas layer already mapped. But the shapefile is not mapped. I tried to reproject the sedf to match with the basemap but still no luck (when I mapped this on AGOL UI, I don't have to reproject my shapefile)&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Code to reproduce:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;shp_df = pd.DataFrame.spatial.from_featureclass(location = "./data/PR_block_2020.shp", sr = 3857)

gis = GIS()

lecz_layer = gis.content.search("Low Elevation Coastal Zones derived from MERIT-DEM", item_type="Imagery Layer")
for item in lecz_layer:
    display(item)
lecz = lecz_layer[0]

m1 = gis.map("Puerto Rico")
m1.content.add(lecz)
shp_df.spatial.plot(map_widget=m1, opacity=0.7)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 22:36:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598365#M11245</guid>
      <dc:creator>HieuTran12</dc:creator>
      <dc:date>2025-03-23T22:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping local shapefile overlayed with Living Atlas layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598421#M11247</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/685546"&gt;@HieuTran12&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Are you using a Jupyter Notebook in ArcGIS Pro?&lt;/P&gt;&lt;P&gt;Try this...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
import pandas as pd

## Access ArcGIS Online
gis = GIS("home")

## path to the shapefile
shp = r"C:\PATH\TO\MY.shp"

## get the item from Living Atlas
lecz = gis.content.get("87f875a0e4ac4400bad9063c18520f9a")

## get the shp as df
df = pd.DataFrame.spatial.from_featureclass(location=shp, sr=3857)

## convert the df to a feature collection
fc = df.spatial.to_feature_collection(name = "PR Block 20202", sanitize_columns="True")

## create a map widget
map_widget = gis.map("Puerto Rico")

## add the layers
map_widget.content.add(lecz.layers[0])
map_widget.content.add(fc)

## display the map
map_widget
&lt;/LI-CODE&gt;&lt;P&gt;Here's my example with counties in Ireland.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Clubdebambos_0-1742804993671.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/128527i3AC132F9EF4253E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1742804993671.png" alt="Clubdebambos_0-1742804993671.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 08:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598421#M11247</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-03-24T08:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping local shapefile overlayed with Living Atlas layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598988#M11253</link>
      <description>&lt;P&gt;Your approach is correct, but the issue might be related to the spatial reference. Try explicitly setting the coordinate system of your spatially enabled DataFrame (sedf) to match AGOL’s Web Mercator (EPSG:3857). Modify your code as follows:&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;from arcgis.features import GeoAccessor, GeoSeriesAccessor&lt;BR /&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;# Load shapefile and reproject&lt;BR /&gt;shp_df = pd.DataFrame.spatial.from_featureclass(location="./data/PR_block_2020.shp")&lt;BR /&gt;shp_df.spatial.set_geometry("SHAPE") # Ensure geometry is set&lt;BR /&gt;shp_df.spatial.project(3857) # Reproject to match AGOL basemap&lt;/P&gt;&lt;P&gt;# Initialize GIS and get Living Atlas layer&lt;BR /&gt;gis = GIS()&lt;BR /&gt;lecz_layer = gis.content.search("Low Elevation Coastal Zones derived from MERIT-DEM", item_type="Imagery Layer")[0]&lt;/P&gt;&lt;P&gt;# Create map and add layers&lt;BR /&gt;m1 = gis.map("Puerto Rico")&lt;BR /&gt;m1.add_layer(lecz_layer)&lt;BR /&gt;shp_df.spatial.plot(map_widget=m1, opacity=0.7)&lt;/P&gt;&lt;P&gt;m1&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 14:39:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/mapping-local-shapefile-overlayed-with-living/m-p/1598988#M11253</guid>
      <dc:creator>WilliamCooper</dc:creator>
      <dc:date>2025-03-25T14:39:05Z</dc:date>
    </item>
  </channel>
</rss>

