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

Updated October 12, 2018 16:22 PM

Updated June 18, 2015 23:09 PM

Updated July 06, 2017 14:22 PM

Updated January 02, 2018 17:22 PM

Updated May 03, 2018 14:22 PM