Bug running "Constructing drive time based service areas" python notebook as written
Opened this issue · 1 comments
mpurnyn commented
Describe the bug
Ran into a bug when attempting to run this notebook as written.
https://developers.arcgis.com/python/samples/constructing-drive-time-based-service-areas/
To Reproduce
Steps to reproduce the behavior:
from datetime import datetime
from IPython.display import HTML
import pandas as pd
from arcgis.gis import GIS
my_gis = GIS('home')
import arcgis.network as network
service_area_url = my_gis.properties.helperServices.serviceArea.url
service_area_url
sa_layer = network.ServiceAreaLayer(service_area_url, gis=my_gis)
fire_station_1_coord = '139.546910,35.695729'
fire_station_2_coord = '139.673726,35.697988'
from arcgis.features import Feature, FeatureSet
f1 = Feature(geometry={'x':float(fire_station_1_coord.split(',')[0]),
'y':float(fire_station_1_coord.split(',')[1])})
f2 = Feature(geometry={'x':float(fire_station_2_coord.split(',')[0]),
'y':float(fire_station_2_coord.split(',')[1])})
fire_station_fset = FeatureSet([f1,f2], geometry_type='esriGeometryPoint',
spatial_reference={'latestWkid': 4326})
map1 = my_gis.map('Tokyo', zoomlevel=12)
map1
fire_truck_symbol = {"type":"esriPMS",
"url":"http://static.arcgis.com/images/Symbols/SafetyHealth/FireTruck.png",
"contentType": "image/png", "width":20, "height":20}
map1.draw(fire_station_fset, symbol=fire_truck_symbol)
travel_modes = sa_layer.retrieve_travel_modes()
truck_mode = [t for t in travel_modes['supportedTravelModes'] if t['name'] == 'Trucking Time'][0]
result = sa_layer.solve_service_area(fire_station_fset, default_breaks=[5,10,15],
travel_direction='esriNATravelDirectionFromFacility',
travel_mode=truck_mode)
error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
[c:\Users\[REDACTED]\AppData\Local\ESRI\conda\envs\project_tbd\Lib\site-packages\arcgis\features\feature.py](file:///C:/Users/[REDACTED]/AppData/Local/ESRI/conda/envs/project_tbd/Lib/site-packages/arcgis/features/feature.py) in sdf(self)
855
--> 856 return from_featureset(fset=self)
857 except ImportError:
[c:\Users\[REDACTED]\AppData\Local\ESRI\conda\envs\project_tbd\Lib\site-packages\arcgis\features\geo\_io\serviceops.py](file:///C:/Users/[REDACTED]/AppData/Local/ESRI/conda/envs/project_tbd/Lib/site-packages/arcgis/features/geo/_io/serviceops.py) in from_featureset(fset, sr)
142 df.spatial.set_geometry("SHAPE")
--> 143 df.spatial.sr = sr
144 for i in range(len(df)):
[c:\Users\[REDACTED]\AppData\Local\ESRI\conda\envs\project_tbd\Lib\site-packages\arcgis\features\geo\_accessor.py](file:///C:/Users/[REDACTED]/AppData/Local/ESRI/conda/envs/project_tbd/Lib/site-packages/arcgis/features/geo/_accessor.py) in sr(self, ref)
3687 if sr != nsr:
-> 3688 self._data[self.name] = self._data[self.name].geom.project_as(ref)
3689 else:
[c:\Users\[REDACTED]\AppData\Local\ESRI\conda\envs\project_tbd\Lib\site-packages\arcgis\features\geo\_accessor.py](file:///C:/Users/[REDACTED]/AppData/Local/ESRI/conda/envs/project_tbd/Lib/site-packages/arcgis/features/geo/_accessor.py) in project_as(self, spatial_reference, transformation_name)
946 """
--> 947 res = self._data.project_as(
948 **{
[c:\Users\[REDACTED]\AppData\Local\ESRI\conda\envs\project_tbd\Lib\site-packages\arcgis\features\geo\_array.py](file:///C:/Users/[REDACTED]/AppData/Local/ESRI/conda/envs/project_tbd/Lib/site-packages/arcgis/features/geo/_array.py) in project_as(self, spatial_reference, transformation_name)
1308 """
-> 1309 return _binary_op_geo(
...
--> 862 raise Exception(
863 "An error occurred with exporting the FeatureSet with message: %s"
864 % str(e)
Exception: An error occurred with exporting the FeatureSet with message: Object: CreateObject error creating spatial reference
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?9cd00303-6c32-412e-84cf-58758da9c239) or open in a [text editor](command:workbench.action.openLargeOutput?9cd00303-6c32-412e-84cf-58758da9c239). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...
Expected behavior
I expected to be able to follow the example and get the service area of the fire stations
Platform (please complete the following information):
- OS: Windows
- Python API Version 3.11.8
- ArcGIS Pro Conda Env
nanaeaubry commented
@ManushiM Can you check on this?