ROS node lat and long topics in Google Maps Javascript
Hello, I have two nodes running, one gives me my latitude, the other gives me my longitude. I am trying to use those two Floats in my google maps JS project and moove my marker depending on these nodes.
var latitude = parseFloat(document.getElementById("latitude").innerHTML);
var longitude = parseFloat(document.getElementById("longitude").innerHTML);
var myLatLng ={lat: latitude, lng: longitude};
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
mapTypeId: 'satellite',
zoom: 15,
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'robot.',
});
}
I get the lat and long in two html divs.
If anyone could help, thank you.