ArcGIS Geometry - AttributeError: 'NoneType' object has no attribute '_tools'

by Bruno Cortez   Last Updated March 14, 2019 20:22 PM

I'm writing a function that takes in two features and calculates the distance between them. I'm using the geometry.distance module.

Here's my code:

from arcgis.gis import *
from arcgis.features import FeatureLayer
from arcgis.geocoding import geocode
from arcgis import geometry

URL = 'url to feature server'
QUERY = 'query parameters'

def get_features(url, query):
    ...
    return features

def calculate_distance(feature1, feature2):
    return geometry.distance('4326', feature1, feature2, distance_unit='meters',\
                             geodesic=False, gis=None)

calculate_distance(features[0], features[1])

This is according to the API geometry.distance(spatial_ref, geometry1, geometry2, distance_unit='', geodesic=False, gis=None), but I get errors when trying to use it.

AttributeError: 'NoneType' object has no attribute '_tools'

How do I use this?



Related Questions




Python code error -Trying to export attachments

Updated July 06, 2017 14:22 PM


joining nearest points to make line in arcgis

Updated May 03, 2018 14:22 PM