Commit 1e0db345 authored by Eric Duminil's avatar Eric Duminil
Browse files

Kinda working import

parent 3ad6d82d
......@@ -67,7 +67,7 @@ const regionChooser = (function(){
const kmlFormat = new ol.format.KML({extractStyles: false});
kml_source.addEventListener("addfeature", function() {
map.getView().fitExtent(kml_source.getExtent(), (map.getSize()));
map.getView().fitExtent(kml_source.getExtent(), map.getSize());
});
function updateGMLPolygons() {
......@@ -383,10 +383,30 @@ const regionChooser = (function(){
}
importWKT = function(e){
console.log("Let's import WKT!!!");
console.log("Let's import WKT Polygon : " + wktPolygon);
var wktPolygon = document.getElementById("wktPolygon").value;
console.log(wktPolygon);
var wktFormat = new ol.format.WKT();
var feature = wktFormat.readFeature(wktPolygon, {
dataProjection : ol.proj.get('EPSG:4326'),
featureProjection : ol.proj.get('EPSG:3857')
});
//TODO: Check if import was succesful
sketch = feature;
updateGMLPolygons();
drawnLayer.getFeatures().clear();
intersections.clear();
drawnLayer.addFeature(feature);
map.getView().fitExtent(feature.getGeometry().getExtent(), map.getSize());
displayInfo();
draw.setActive(false);
e.preventDefault(); // to avoid refresh
}
// Executed by JavaFX when whole page is loaded.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment