In addition to what Jason says, I don't think the GIS navigator functions properly with points made while the model's running. If you generate your points beforehand using a script or user command and then A-connect the Task Executer to a point, it should function correctly. Here's a rework of your code to generate points with code rather than process flow:
// Create a map object if one does not exist
Object map = model().find("MyMap_1");
if (!map) {
map = createinstance(library().find("/GIS/Map"), model());
map.name = "MyMap_1";
map.setSize(30, 20, 2);
map.setLocation(10, 0, 0);
map.setProperty("Latitude", 40.54);
map.setProperty("Longitude", -111.76);
map.setProperty("Zoom", 11.87);
}
// The map should have asserted a GISNavigator when it was created
Object navigator = model().find("GISNavigator");
if (!navigator)
return 0;
//reference an existing global table with all the cities and their latitude and longitude
Table data = Table("Data_Points");
if (navigator.subnodes.length == data.numRows) {
return 1;
}
// Delete any existing points
navigator.subnodes.clear();
for (int i = 1; i <= data.numRows; i++) {
// Create the first point
Object point1 = createinstance(library().find("/GIS/Point"), navigator);
point1.name = data["Origin"];
point1.setProperty("Latitude", data["Origin_Lat"]);
point1.setProperty("Longitude", data["Origin_Lon"]);
// Create a second point
Object point2 = createinstance(library().find("/GIS/Point"), navigator);
point2.name = data["Destination"];
point2.setProperty("Latitude", data["Destination_Lat"]);
point2.setProperty("Longitude", data["Destination_Lon"]);
// Connect the points to create a route
contextdragconnection(point1, point2, "A");
// Get a reference to the newly created route
treenode routeNode = getvarnode(point1, "routes").last;
// Set its Update Type to Driving Roads and Update it
routeNode.subnodes["updateType"].value = GIS_UPDATE_TYPE_DRIVING_ROADS;
function_s(navigator, "updateRoute", routeNode);
}
//repaint the map to show new points
repaintall();