Visualizing route layer on ArcPy Jupyter Notebook (ArcGIS) does not work!

542
2
Jump to solution
12-08-2019 01:05 PM
d4001628urhen
New Contributor II

I tried to visualize the route between two points using ArcPy in a Jupyter notebook. The network module is activated in my Esri account. Even though it visualizes the map I can't see the route on that as the Tutorial shows.

Here is the code I used. I guess the problem with visualization. However I can see the following message on the console. I can see the route Results but the problem is with displaying that. Also I can render the maps without routing layers. 

> [esri.views.LayerViewFactory] Failed to create view for layer 'Terrain3D, id:worldElevation' of type 'elevation'

(I tried with both Windows and Linux, Esiri Notebook environments and the result is still the same )

from copy import deepcopy
from datetime import datetime
from IPython.display import HTML
import json
import pandas as pd
from arcgis.gis import GIS
import arcgis.network as network
import arcgis.geocoding as geocoding

user_name = 'user'
password = 'pw'
my_gis = GIS('https://www.arcgis.com', user_name, password)

route_service_url = my_gis.properties.helperServices.route.url
route_service = network.RouteLayer(route_service_url, gis=my_gis)

stops = '''-3.203062,55.906437; -3.190080,55.935570'''

route_layer = network.RouteLayer(route_service_url, gis=my_gis)
result = route_layer.solve(stops=stops,
   directions_language='en-US',
   return_routes=True,
   return_stops=True, return_directions=False,
   return_barriers=False,
   return_polygon_barriers=False,
   return_polyline_barriers=False)

my_map = my_gis.map('Braidburn Valley', zoomlevel=13)
my_map

Thanks. 

0 Kudos
1 Solution

Accepted Solutions
HåkonDreyer
Esri Contributor

Seems you haven't drawn the route on the map yet. It happens in the next step [20] of the Tutorial.

View solution in original post

2 Replies
HåkonDreyer
Esri Contributor

Seems you haven't drawn the route on the map yet. It happens in the next step [20] of the Tutorial.

d4001628urhen
New Contributor II

Seems that was the issue. Thanks for pointing that out. Also could you pls provide some insights here? That would be really helpful. Thanks. 

0 Kudos