Skip to content
Snippets Groups Projects

feat: Add test page (spatial) with mapserver layer in openlayers map

Merged Lene Wasskog requested to merge feature/gridv-6-mapserver-layer into develop
2 files
+ 38
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -609,6 +609,7 @@ async function initDataSourceMap(containerId, geoJson, countryCodeList, featureC
@@ -609,6 +609,7 @@ async function initDataSourceMap(containerId, geoJson, countryCodeList, featureC
extent = featureOverlay.getSource().getExtent();
extent = featureOverlay.getSource().getExtent();
map.getView().fit(extent, map.getSize());
map.getView().fit(extent, map.getSize());
}
}
 
/*
/*
* A little bit of this and that to make feature selection work the way we want
* A little bit of this and that to make feature selection work the way we want
@@ -679,6 +680,10 @@ const styleUnselected = new ol.style.Style({
@@ -679,6 +680,10 @@ const styleUnselected = new ol.style.Style({
})
})
});
});
 
/*
 
* Singleton pattern works. Used in function below
 
*/
 
/**
/**
@@ -699,6 +704,31 @@ function handleMapClicked(map, layer, pixel, coordinate, featureClickedCallback)
@@ -699,6 +704,31 @@ function handleMapClicked(map, layer, pixel, coordinate, featureClickedCallback)
// Area
// Area
if(features[0].getId() === undefined)
if(features[0].getId() === undefined)
{
{
 
// We must place a marker where the user clicked
 
let marker = map.getOverlayById("marker");
 
// If first time click, create a new marker
 
if(marker == undefined)
 
{
 
map.addOverlay(new ol.Overlay({
 
id: "marker",
 
element: function() {
 
let markerElement = document.createElement("div");
 
markerElement.setAttribute(
 
"style",
 
"width: 20px; height: 20px; border: 1px solid #088; border-radius: 10px; background-color: #0FF; opacity: 0.5;"
 
);
 
return markerElement
 
}(),
 
position: coordinate,
 
positioning: "center-center"
 
})
 
);
 
}
 
// Otherwise, just move the current marker
 
else
 
{
 
marker.setPosition(coordinate);
 
}
featureClickedCallback(null, getDecimalDegrees(map, coordinate));
featureClickedCallback(null, getDecimalDegrees(map, coordinate));
}
}
// Click on a station is handled in the select interaction (see initDataSourceMap)
// Click on a station is handled in the select interaction (see initDataSourceMap)
@@ -713,6 +743,11 @@ function handleMapClicked(map, layer, pixel, coordinate, featureClickedCallback)
@@ -713,6 +743,11 @@ function handleMapClicked(map, layer, pixel, coordinate, featureClickedCallback)
}
}
};
};
 
function createMarkerOverlay(coordinate)
 
{
 
 
}
 
/**
/**
*
*
* @param {ol.Map} map
* @param {ol.Map} map
Loading