Created
October 13, 2022 14:18
-
-
Save plamen9/3344d0ad75bf9930fade38d7eb25295e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lMapRegion = apex.region("map_search"), | |
// important: Use the layer name exactly as specified in the "name" attribute in Page Designer | |
lLayerId = lMapRegion.call("getLayerIdByName", "Map Search"), | |
lCurrentZoom = lMapRegion.call("getMapCenterAndZoomLevel").zoom, | |
lLocationId = apex.item("P27_GEOLOCATOR").getValue(), | |
lFeature = lMapRegion.call("getFeature", lLayerId, lLocationId ), | |
lPosition; | |
console.log("lLocationId -> " + lLocationId); | |
//if ( lFeature.geometry ) { | |
//lPosition = lFeature.geometry.coordinates; | |
lPosition = jQuery.parseJSON( lLocationId ); | |
console.log("lPosition -> " + lPosition); | |
// close all Info Windows, which might currently be open | |
lMapRegion.call( "closeAllInfoWindows" ); | |
// focus the map to the chosen feature | |
//lMapRegion.call( "setCenter", lPosition ); | |
apex.region( "map_search" ).setCenter( lPosition.coordinates ); | |
// if the current zoom level is below 12, zoom to 9. Otherwise do nothing. | |
if ( lCurrentZoom < 12 ) { | |
lMapRegion.call( "setZoomLevel", 9 ); | |
} | |
setTimeout( function() {lMapRegion.call( "displayPopup", "infoWindow", lLayerId, lLocationId.toString(), false )}, 500 ); | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment