×
Pleas keep in mind that SPAM will be deleted instantly
Joodatabase Field in JS in Google Maps
- Stefanato
- Topic Author
- Offline
Less
More
- Posts: 28
- Thank you received: 0
7 years 6 months ago #4190
by Stefanato
Joodatabase Field in JS in Google Maps was created by Stefanato
Hi,
in the Single entry-Template, the following script works correctly if I use the numeric values of coordinates, but if I insert the joodatabase fiels values :
{joodb field|latitude} and {joodb field|longitude}, the maps is blank and it does not work :
Does the joodatabase tags conflict with javascript ?
Thanks in advance.
in the Single entry-Template, the following script works correctly if I use the numeric values of coordinates, but if I insert the joodatabase fiels values :
{joodb field|latitude} and {joodb field|longitude}, the maps is blank and it does not work :
Does the joodatabase tags conflict with javascript ?
Thanks in advance.
<div id="map" style="width:500px;height:500px;"></div>
<script>
// This example creates circles on the map, representing populations in North
// America.
// First, create an object containing LatLng and population for each city.
var citymap = {
chicago: {
//------------------ JOODATABASE FIELDS-------------
center: {lat: {joodb field|latitude}, lng: {joodb field|longitude}},
population: 2714856
}
};
function initMap() {
// Create the map.
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: {lat: 45.4064823, lng: 11.821206,12},
mapTypeId: 'terrain'
});
// Construct the circle for each value in citymap.
// Note: We scale the area of the circle based on the population.
for (var city in citymap) {
// Add the circle for this city to the map.
var cityCircle = new google.maps.Circle({
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center: citymap[city].center,
radius: Math.sqrt(citymap[city].population) * 1
});
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxx&callback=initMap">
</script>
Please Log in to join the conversation.
Moderators: Dirk, joest