laptop and a wrench

Erro

When running the lengths() function from the ArcGIS API for Python on a Polyline object, the function fails and returns the error message, “The operation was attempted on an empty geometry".

ArcGIS API for Python
Número de ID do Erro BUG-000178221
EnviadoJuly 25, 2025
Última ModificaçãoSeptember 4, 2025
Aplica-se àArcGIS API for Python
Versão encontrada2.4.1
Sistema OperacionalN/A
Versão do Sistema OperacionalN/A
Versão Fixa2.4.2
StatusFixed

Solução Provisória

Use the LengthUnits class to do this:

from arcgis.geometry import Polyline

from arcgis.geometry import lengths, LengthUnits

simple_polyline = Polyline({

  "paths": [[[-95.5, 30.2], [-95.6, 30.3]]],

  "spatialReference": {"wkid": 4326}

})

print(type(simple_polyline))

print(simple_polyline)

usFeet_simple = lengths(

  spatial_ref={"wkid": 4326},

  polylines=[simple_polyline],

  length_unit=LengthUnits.FOOT,

  calculation_type='geodesic',

  gis=gis

)

print("Length in US feet (simple):", usFeet_simple)

Etapas para Reproduzir

ID do Erro: BUG-000178221

Software:

  • ArcGIS API for Python

Seja notificado quando o status de um erro mudar

Baixe o Aplicativo de Suporte da Esri

Descubra mais sobre este tema

Obtenha ajuda de especialistas do ArcGIS

Entre em contato com Suporte Técnico

Baixe o Aplicativo de Suporte da Esri

Ir para as opções de download