<?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: Job Failed when publishing excel item in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226385#M7945</link>
    <description>&lt;P&gt;Hm. Can you double-check the spatial reference of each layer?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Oct 2022 20:18:33 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-10-27T20:18:33Z</dc:date>
    <item>
      <title>Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225379#M7938</link>
      <description>&lt;P&gt;Hi esri community,&lt;/P&gt;&lt;P&gt;I'm trying to upload a locally saved excel file as a feature layer but I keep running into the "Job Failed" error, very similar to a post I saw regarding the same issue&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/exception-job-failed-when-publishing-csv-item/td-p/1036154" target="_blank" rel="noopener"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is the code I've written so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import arcgis
import os
import datetime as dt
import pandas as pd
from arcgis.gis import GIS
from arcgis.features import GeoAccessor, GeoSeriesAccessor
from numpy.random import rand

gis = GIS()
agol_gis = GIS("organization link","username","password")

# Loading in the Bight data
bight = pd.read_excel(r'C:\Users\GisUser\Desktop\bight18-field-clean.xlsx', sheet_name = "grab", header = 0)

sdf = GeoAccessor.from_xy(bight, 'latitude','longitude')

lyr = sdf.spatial.to_featurelayer('bight18grabtest', gis=agol_gis)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently using VS Code and my environment seems up to date. Is there something I am missing here? Any help on this is greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Mina&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 19:51:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225379#M7938</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-25T19:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225389#M7940</link>
      <description>&lt;P&gt;Publishing a layer from a dataframe has given me trouble in the past, too. What about creating an empty layer first, then using your dataframe to load features into it?&lt;/P&gt;&lt;PRE&gt;destination_layer.edit_features(adds=sdf.spatial.to_featureset())&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2022 19:57:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225389#M7940</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-25T19:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225422#M7942</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp; I would have never guessed that! I appreciate the insight.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 20:43:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1225422#M7942</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-25T20:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226378#M7944</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;So I ended up going a different route. I transformed the data frame into a spatially enabled dataframe (sdf) and tried to simply plot the sdf using&amp;nbsp;spatial.plot. The webmap shows another layer from AGOL but not the points from the sdf.&lt;/P&gt;&lt;P&gt;My goal is a simple point-in-polygon check to see if points fall within another layer's boundaries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
import os
import datetime as dt
import pandas as pd
from arcgis.gis import GIS
from arcgis.features import GeoAccessor, GeoSeriesAccessor
from numpy.random import rand
from arcgis.geometry import Geometry
from arcgis.geometry.filters import within
from arcgis.geometry.filters import contains
from arcgis.geocoding import geocode
from arcgis.geometry import lengths, areas_and_lengths, project
from arcgis.geometry import Point, Polyline, Polygon, Geometry
from arcgis.mapping import WebMap

# Loading in the Bight data
bight = pd.read_excel(r'C:\Users\GisUser\Desktop\bight2018_clean.xlsx', sheet_name = "grab", header = 0)

bight.columns = bight.columns.str.lower() # Lowercase all columns for consistency
bight

# Creating a spatially enabled dataframe from loaded data
sdf = GeoAccessor.from_xy(bight, 'latitude','longitude')
sdf

# Creating point object from the dataframe
pt = Point({"x": sdf["latitude"], "y": sdf["longitude"]})

# Calling on the Strata layer using portal item id
strata = gis.content.get('387791e1c66b4ae6bbadda60848ddecc')
strata

query1 = strata.layers[0].query()
resp1 = query1.features
resp1[0].geometry
strataLayer = Geometry(resp1[0].geometry)
strataLayer

# Create map / add layer to map
wm = gis.map("California")
wm.add_layer(strata)
wm

print(pt.within(strataLayer))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output from both the "within" and "contains" function are "None" but I know there are points within the polygon.&amp;nbsp;Any insight on how I can get this to script to work?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 20:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226378#M7944</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-27T20:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226385#M7945</link>
      <description>&lt;P&gt;Hm. Can you double-check the spatial reference of each layer?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 20:18:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226385#M7945</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-27T20:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226400#M7946</link>
      <description>&lt;P&gt;Yes. Both have the same spatial reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;strata.spatialReference
# '102100'

p.spatialReference
#{'wkid': 102100}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Oct 2022 20:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226400#M7946</guid>
      <dc:creator>sccwrp</dc:creator>
      <dc:date>2022-10-27T20:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Job Failed when publishing excel item</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226405#M7947</link>
      <description>&lt;P&gt;Point and Geometry would both return a singular object, right? What about creating a GeoSeriesAccessor from the geometry columns of your dataframes, then using overlay operations with those?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 20:51:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/job-failed-when-publishing-excel-item/m-p/1226405#M7947</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-10-27T20:51:30Z</dc:date>
    </item>
  </channel>
</rss>

