Select to view content in your preferred language

spatial.to_featurelayer strips time resulting in data loss

1228
2
Jump to solution
04-01-2021 05:10 AM
martinschaefer1
Occasional Contributor

Hi,

 

Exporting a spatially enabled dataframe (SDF) to AGOL using spatial.to_featurelayer with a datetime column strips the time as it creates a shapefile and due to the way shapefiles handle dates. Alternative is to create a str column using strftime or to use the more cumbersome method of creating a csv item and publishing that, completely bypassing the SDF.

 

Could  I suggest:

  1. Adding a check to to_featurelayer, and either returning  a warning or converting the datetime to string
  2. Adding a warning to the documentation

Code to demonstrate the issue attached as .ypnb.

 

Best wishes

M.

 

 

1 Solution

Accepted Solutions
martinschaefer1
Occasional Contributor

That's a good shout. I was using AGOL Notebooks, which I kinda assumed had the latest version. Lesson 1, check, don't trust.

AGOL Notebooks is on 1.8.1, and to_featurelayer creates a shapefile. Running a Pro Notebook shows 1.8.3, and to_featurelayer creates a gdb in AGOL, solving this issue.

I will let ESRI support know, as I had raised a job with them first, they did not have the solultion, thanks for the suggestion.

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

What version of the api are you using?

There was a reported issue with datetime on their site

Issues · Esri/arcgis-python-api (github.com)

But if it doesn't apply, then you should open an Issue on their github site

Issues · Esri/arcgis-python-api (github.com)


... sort of retired...
martinschaefer1
Occasional Contributor

That's a good shout. I was using AGOL Notebooks, which I kinda assumed had the latest version. Lesson 1, check, don't trust.

AGOL Notebooks is on 1.8.1, and to_featurelayer creates a shapefile. Running a Pro Notebook shows 1.8.3, and to_featurelayer creates a gdb in AGOL, solving this issue.

I will let ESRI support know, as I had raised a job with them first, they did not have the solultion, thanks for the suggestion.

0 Kudos