Auto Updata Map with add up locations

Could you please tell me how to make the Map update automatically with the data provide from database (It always update with new location with altitude and longitides)?
I need to pass data to Alt,Lng and popup window's params.

image

If from the database, you could make a couple named queries to get the lat and long.

And then use query bindings on these values to get those results

1 Like

I want to make it when the database is added with a new location/data. Is there any way?

You generally cannot "subscribe" to changes in a database with vanilla JDBC. You have to arrange to "poll" the database for changes in some way. (Not always easy to make performant--may involve DB triggers saving notifications in a special pollable table.)

1 Like

Depends on how often this database table is updated and how urgent this value is. When I've done similiar stuff before the table rarely updated and it was just for reference, so I just had a query tag that was a leased tag mode, it would poll every 5 minutes when not displayed and every 10 seconds when on a mimic.

That way to the user it will appear to update after a short delay, like some of the tags we displayed on that system.

If it updates much more often, you may need a more complicated system where the database splits the data into a new table every month or week (to reduce query time) and then poll it much faster, like every second and that will get you as close to a live value as is really possible. Or do as Phil says and have some other notification table.

1 Like

I did it using binding(Query) to the marker.
Here is the code.

	'markers =[ ]'
	'pydata = system.dataset.toPyDataSet(value)'
	tooltip = {'enabled':False,'direction':'auto','permanent':False,'sticky':False,'opacity':1}
		
	for row in pydata:
		power = '{:.1f}'.format(row['Power']) # limit decimal points |#'{:.2f}'.format(5.39120)
		power1 = str (power) + " MW" # MW
		
		status= (row['Status']) 			#Status of the site
				
		markers.append({'lat':(row['Latitude']*0.001),'lng':(row['Longitude']*0.001),'opacity':1,'riseOnHover':False,'riseOffset':250,
		'icon':{'path':'material/location_on','color':'#149DEE' if status == True else '#888888' ,'size':{'width':36,'height':36}},
		'tooltip':tooltip,
		'popup':{'enabled':False,'content':{'path':"", 'view': {'path':'Objects/Map_Popup','params':{'P_name': (row['Asset_Name']), 'powerV':power1, 'Status': "Running" if status == True else "Fault" , 'P_Type': row['SiteType'] }}},'width':{'max':150,'min':110},
		'height':{'max':100,'min':90},'pan':{'auto':True},'closeButton':True,'autoClose':True,'closeOnEscapeKey':True}})    
		
		
		
		self.getSibling("TextArea").props.text = markers
	
	#if( (row['Status'])== true) : Status1= "Running'
	return markers

I used 'transaction groups' to update the database.