Hi all,
I have a few questions regarding the Map component. We are trying to add markers onto the map, which works successfully for a few points. When we add about 600 points though, the component completely stops functioning for us and times out. This happens when we do the following:
map = self.getSibling('Map')
PARENT_PATH = "[default]Test Wells"
STRING_SLASH = "/"
TAGNAME_NAME = "Name"
TAGNAME_LAT = "Latitude"
TAGNAME_LON = "Longitude"
TAGNAME_STATUS = "Status"
TAGNAME_MODE = "Mode"
TAGNAME_RATE = "Rate"
wells = system.tag.browseTags(PARENT_PATH)
data = []
for well in wells:
namePath = STRING_SLASH.join([str(well), TAGNAME_NAME])
latitudePath = STRING_SLASH.join([str(well), TAGNAME_LAT])
longitudePath = STRING_SLASH.join([str(well), TAGNAME_LON])
statusPath = STRING_SLASH.join([str(well), TAGNAME_STATUS])
modePath = STRING_SLASH.join([str(well), TAGNAME_MODE])
ratePath = STRING_SLASH.join([str(well), TAGNAME_RATE])
paths = [namePath, latitudePath, longitudePath, statusPath, modePath, ratePath]
qvs = system.tag.readAll(paths)
values = {
TAGNAME_NAME:qvs[0].value,
TAGNAME_LAT:qvs[1].value,
TAGNAME_LON:qvs[2].value,
TAGNAME_STATUS:qvs[3].value,
TAGNAME_MODE:qvs[4].value,
TAGNAME_RATE:qvs[5].value,
}
data.append(values)
def doAsynch():
markers = []
for index, point in enumerate(data):
marker = shared.map.makeMarker(
name=point[TAGNAME_NAME],
lat=point[TAGNAME_LAT],
lng=point[TAGNAME_LON],
text=point[TAGNAME_NAME],
tooltipText=point[TAGNAME_NAME],
tooltipPermanent=False,
)
markers.append(marker)
map.props.layers.ui.marker = markers
system.util.invokeAsynchronous(doAsynch)
It seems to have worked a few times initially, even with a permanent tooltip (though cluttered a bit), but stopped working later on in the day for no apparent reason (maybe too much memory usage? or something on my personal computer?).
A few questions:
-
Is it possible to get the zoom level and the boundaries (minLat, maxLat, minLng, maxLng) from the map at any point? So we can try to de-clutter at low zooms.
-
Is it better for the “markers” variable to be a list, or a java DocumentArray object?
-
Looks like you can’t write a json/dictionary/list to a tag unless you completely convert it to a Document object. Is this going to be fixed, or would a function be provided to do this?
-
Pipe dream, but would we be able to connect the windy raster/tile (https://www.windy.com) to the Map component, or is this not feasible? Would we need a custom module to do this?
-
Is there an alternative to just making 600+ points on a map, or should we do something different to avoid this?
Best,
Roger