Select to view content in your preferred language

Automatic Update layer via Google Docs

1448
5
05-07-2021 08:54 PM
Labels (1)
FireRidge
Emerging Contributor

Hello all. Here is my scenario. In integromat I am:

  • calling a Geojson API
  • converting data to a csv (the Geojson layer kept assigning a number field to a string hence with a csv upload I had control over the field type)
  • updating the original csv file in google docs
  • said google doc is what created the feature layer. 

Is there a way to auto append or auto overwrite the table without doing it manually in the content viewer for said layer?

 

thanks 

FireRidge 

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

There is an overwrite function in the Python API that will take a CSV as an input. A bit of python scripting can automate the process easily enough. It's important to note that when you add a Google Sheet to AGOL / Enterprise, all it's really doing is reading that spreadsheet as text, so if you have the CSV, you can eliminate the Google Docs step entirely.

Also, if your layer has a unique identifier field, you can use append instead, which preserves existing settings and field types.

- Josh Carlson
Kendall County GIS
0 Kudos
FireRidge
Emerging Contributor

Thank you for the response. The csv has been a work around since the https geojson address I keep trying to add keeps giving me general error. Is there a way to clean up the geojson file (to make sure fields have the correct type) before I import nor overwrite layer? 
So far I can’t figure out why I keep getting an error when trying to import this geojson file —see below 

https://www.fire.ca.gov/umbraco/api/IncidentApi/GeoJsonList?inactive=true&year=2021

 

0 Kudos
jcarlson
MVP Esteemed Contributor

You can convert a GEOJON directly to a FeatureSet using FeatureSet.from_geojson. From there, you can convert the FeatureSet to a Spatially Enabled DataFrame, which would let you control the field types prior to uploading / appending.

- Josh Carlson
Kendall County GIS
0 Kudos
FireRidge
Emerging Contributor

Josh

You have been s super help with directing me towards a final solution. 

I am going to try and call https://www.fire.ca.gov/umbraco/api/IncidentApi/GeoJsonList?inactive=true&year=2021

within a google python function (https trigger) 

Before I go down the rabbit hole ( i do not have experience with python) do you think it is possible to use the ArcGIS Python api in a google function to

 

  • populate said geojson as a layer
  • Format said layer
  • overwrite said layer (with https trigger set on timer) 

Thanks again

 

Josh 

 

Screen Shot 2021-05-10 at 1.04.40 PM.png

0 Kudos
jcarlson
MVP Esteemed Contributor

I imagine you could. I have not used Google functions in ages, but I have seen users on here mention using it for certain tasks.

- Josh Carlson
Kendall County GIS
0 Kudos