Select to view content in your preferred language

Esri Advanced Guide to Python Chap. 10 JSONDecodeError

484
3
Jump to solution
10-15-2025 12:06 PM
JaredPilbeam2
MVP Alum

Not sure what's causing this error. I did notice that the 2020 wildfires layer referenced in the 10-01 tutorial has been depreciated: c3c10388e3b24cec8a954ba10458039d

It's throwing the error on the structures variable. I've been working through the jupyter cells and can't go any further because of the error. I've put the code so far here. The authors are Dave Crawford and Daniel Yaw. 

import arcgis
import time

gis = arcgis.GIS('home')
# get the layer for USA structures
item_id_structures = '0ec8512ad21e4bb987d7e848d14e7e24'
item_structures = gis.content.get(item_id_structures)
lyr_structures = item_structures.layers[0]

# get the layer for 2020 wildfires
item_id_wildfires = 'c3c10388e3b24cec8a954ba10458039d'
item_wildfires = gis.content.get(item_id_wildfires)
lyr_wildfires = item_wildfires.layers[1]
fset_single_wildfire = lyr_wildfires.query("FIRE_NAME = 'AVILA'")
fset_single_wildfire
# get the feature from the FeatureSet
wildfire_feature = fset_single_wildfire.features[0]
# get the geometry from the single feature
wildfire_geom = wildfire_feature.geometry

# get the wildfire name
wildfire_name = wildfire_feature.get_value("FIRE_NAME")

print(wildfire_name)
# Create a spatial filter to find structures that intersect the wildfire
wildfire_filter = arcgis.geometry.filters.intersects(
    wildfire_geom, sr = wildfire_geom['spatialReference']
)
# Query the structures layer for structures that intersect the wildfire
structures = lyr_structures.query(
    geometry_filter = wildfire_filter,
    return_count_only=True
)
print(structures)
0 Kudos
1 Solution

Accepted Solutions
Esri_Dave_Crawford
Esri Contributor

Hey there!  Quick question.  Can you check and see what version of the ArcGIS API for Python you're using?  You can do that by executing the following line.

arcgis.__version__

 

I was able to reproduce your error when I was on version 2.4.1.  I upgraded to 2.4.1.3 (a more recent patch) and that fixed the issue.  Could you try that and see if it fixes things for you?

View solution in original post

3 Replies
Craig_Carpenter
Esri Regular Contributor

Thanks for the question, we're looking into fixes, we'll post here once we have something.

0 Kudos
Esri_Dave_Crawford
Esri Contributor

Hey there!  Quick question.  Can you check and see what version of the ArcGIS API for Python you're using?  You can do that by executing the following line.

arcgis.__version__

 

I was able to reproduce your error when I was on version 2.4.1.  I upgraded to 2.4.1.3 (a more recent patch) and that fixed the issue.  Could you try that and see if it fixes things for you?

JaredPilbeam2
MVP Alum

Thanks Dave! Yes, I was on v. 2.4.1.1. For some reason, even though I was signed in, Pro Package Manager was showing an update to v. 2.4.1.3 but did not have the usual Update button available. So, by that method I couldn't update.

However, I was able to update through the python command prompt as an administrator. No more error.