Skip to content
Snippets Groups Projects
Commit 86e6f489 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

New observation map geoinfo coordinate correction

parent b20bad82
No related branches found
No related tags found
No related merge requests found
...@@ -109,14 +109,16 @@ export default { ...@@ -109,14 +109,16 @@ export default {
let coord = [pos.coords.longitude,pos.coords.latitude]; let coord = [pos.coords.longitude,pos.coords.latitude];
let transFormCord = transform(coord, 'EPSG:3857','EPSG:4326'); let transFormCord = transform(coord, 'EPSG:3857','EPSG:4326');
this.myMap.getView().setCenter(fromLonLat(coord)); this.myMap.getView().setCenter(fromLonLat(coord));
this.clearMapLayers();
let myImage = this.myImage(); let myImage = this.myImage();
let vectorSource = new VectorSource({}); let vectorSource = new VectorSource({});
var iconFeature = new Feature({ var iconFeature = new Feature({
geometry: new Point(fromLonLat(coord)) geometry: new Point(fromLonLat(coord))
}); });
vectorSource.addFeature(iconFeature); vectorSource.addFeature(iconFeature);
var vectorLayer = new VectorLayer({ var vectorLayer = new VectorLayer({
source: vectorSource, source: vectorSource,
...@@ -124,16 +126,15 @@ export default { ...@@ -124,16 +126,15 @@ export default {
image: myImage, image: myImage,
}), }),
}); });
this.clearMapLayers();
this.myMap.addLayer(vectorLayer);
this.myMap.getView().setZoom(CommonUtil.CONST_GPS_OBSERVATION_ZOOM);
let geoGSON = new GeoJSON(); let geoGSON = new GeoJSON();
let resultGeoGSON = geoGSON.writeFeatures(vectorLayer.getSource().getFeatures()); let resultGeoGSON = geoGSON.writeFeatures(vectorLayer.getSource().getFeatures());
this.myGeoInfo = JSON.parse(resultGeoGSON); this.myGeoInfo = JSON.parse(resultGeoGSON);
this.myGeoInfo.features[0].geometry.coordinates=coord;
this.myMap.addLayer(vectorLayer);
this.myMap.getView().setZoom(CommonUtil.CONST_GPS_OBSERVATION_ZOOM);
}, },
geolocationError(error){ geolocationError(error){
...@@ -263,7 +264,7 @@ export default { ...@@ -263,7 +264,7 @@ export default {
dataProjection: 'EPSG:4326', dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857' featureProjection: 'EPSG:3857'
}); });
console.log(resultGeoGSON);
This.myGeoInfo = JSON.parse(resultGeoGSON); This.myGeoInfo = JSON.parse(resultGeoGSON);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment