This can be used as a reference only. ©
- You need to get a key from google, this key will be used in the google map javascript.Click on the below link to get the key.
2. Create a UI map which will hold the google map.
Ui Map : CmGoogleMap
Ui Map Type : Complete Html Document
3. UI Map Schema (find inline comment for more details)
<html>
<head>
<title>Geocoding service</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
width:600;
height: 300;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 30%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script>
function myFunction(){
// alert('13292 Lake Ave NE, Hartville, OH, 44632');
//alert(top.model().getValue('PREM_INFO'));
}</script>
<div id="map"></div>
<script>
function initMap() {
myFunction();
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
height: 50,
width:50,
center: {lat: -34.397, lng: 150.644}
});
map.setTilt(45);
var geocoder = new google.maps.Geocoder();
/* get the address from page data model */
var address=top.model().getValue('PREM_INFO');
/* convert address to longitude and latitude */
geocodeAddress(geocoder, map, address );
}
function geocodeAddress(geocoder, resultsMap, address ) {
//var address = '10820 Mogadore Ave NW,44685,usa';
geocoder.geocode({'address': address}, function(results, status) {
if (status === 'OK') {
resultsMap.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: resultsMap,
position: results[0].geometry.location
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key="###########PASTE YOUR API KEY HERE########################">
</script>
<div id="premiseId" oraField="premiseId"></div>
</body>
<xml>
</xml>
</html>
4. Add explicit map zone
5. Add The above zone to premise portal
6. Test Your code (Search any premise and go to premise portal)
😅😆😇
Thank you! Any plans to release new customization? Maybe Twitter feed integration?
ReplyDelete