I need to represent a route in a map and give a visual representation of a variable. For example, a car wants to go from point A to point B and I want to represent the amount of fuel left in the tank.
I have decided to use ArcGIS to do it but I can't find a proper way to draw a line with changing color. So far what I am doing is creating a new line every two points and changing its color. The problem with this is that in some cases I am drawing more than 4000 lines and it is quite slow to draw.
This is an example of the code that I am using right now (I am using python):
max_elevation = activity_data["Elevation"].max()
min_elevation = activity_data["Elevation"].min()
range_elevation = max_elevation - min_elevation
for index, row in activity_data.iterrows():
actual_row = activity_data.loc[index]
next_row = activity_data.loc[index+1]
if index != activity_data.size:
sym_poly_aoi = {
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [0,0,0,0],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [(actual_row["Elevation"]-min_elevation)/range_elevation*255,0,0,255],
"width": 3}
}
line = {"paths" : [[[actual_row["Longitude"],actual_row["Latitude"]],[next_row["Longitude"],next_row["Latitude"]]]]}
polyline = Polyline(line)
map2.draw(polyline,symbol = sym_poly_aoi)
The problem is that it takes around 5 min to draw it and I need something faster.
