Perspective Map Component Issues

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:

  1. 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.

  2. Is it better for the “markers” variable to be a list, or a java DocumentArray object?

  3. 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?

  4. 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?

  5. Is there an alternative to just making 600+ points on a map, or should we do something different to avoid this?

Best,
Roger

Where do you get the API's for openstreetmap? Any link to documentation?

Hi,

  1. Not yet, but this feature has been requested and is currently sitting in our queue awaiting implementation.
  2. A list should work just fine.
  3. Use system.util.jsonEncode which will turn your PyObject into a JSON string which a Document tag should accept.
  4. Windy is a plugin that is built on top of the same library that we are using for the map component (Leaflet). If they had a tile server, you could surely integrate with our map component, but they don’t. Besides, I think the tiles are not what you want, but instead the feature layers, since the tiles/basemap are a pretty generic world map. Are you trying to integrate with some sort of weather service (fyi, the weather channel also uses the Leaflet library for there maps)? Do you need suggestions for where you might retrieve tilesets?
  5. Are you seeing any errors in the console or browser console when the map starts to break down?

-Yousuf