Skip to content
Snippets Groups Projects
Commit 317f55f7 authored by Olabarrieta Palacios, Ignacio's avatar Olabarrieta Palacios, Ignacio
Browse files

a

parent 871facde
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
<div class="modal" id="newNewGeoJSONModal" style='display:none;z-index:2000'> <div class="modal" id="newNewGeoJSONModal" style='display:none;z-index:2000'>
<div class="modal-content" style="width:80%;height:170px"> <div class="modal-content" style="width:80%;height:170px">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" (click)="closenewNewGeoJSONModal();"> <button type="button" class="close" data-dismiss="modal" style="z-index: 1000;"aria-label="Close" (click)="closenewNewGeoJSONModal();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<div class="modal-header"> <div class="modal-header">
......
...@@ -65,7 +65,7 @@ export class NoiseCompComponent implements OnInit { ...@@ -65,7 +65,7 @@ export class NoiseCompComponent implements OnInit {
public model_names = []; public model_names = [];
public traffic_names = []; public traffic_names = [];
public static newSquareLayer; public static newSquareLayer;
public geojson = {};
ngOnInit(): void { ngOnInit(): void {
let pilotName = this.configService.getSettings("default_pilot"); let pilotName = this.configService.getSettings("default_pilot");
if (pilotName === "BILBAO" || pilotName === "URBANITE") { this.city = "0"; } if (pilotName === "BILBAO" || pilotName === "URBANITE") { this.city = "0"; }
...@@ -477,7 +477,14 @@ export class NoiseCompComponent implements OnInit { ...@@ -477,7 +477,14 @@ export class NoiseCompComponent implements OnInit {
this.marks = []; this.marks = [];
if ( ps != null ){ if ( ps != null ){
for(let j=0;j<ps.length;j++){ for(let j=0;j<ps.length;j++){
let mark = L.circle(ps[j], {radius: 2, color: this.getClr2(vl,j,qs), opacity:.5}).addTo(this.map); let mark = new L.CircleMarker(ps[j], {radius: 2, color: this.getClr2(vl,j,qs), opacity:.5});
mark['value'] = vl[j];
//mark['options']['value'] = vl[j];
//mark['properties'] = {};
//mark['properties']['value'] = vl[j];
//mark['feature']['properties']['value'] = vl[j]
//console.log(mark);
mark.addTo(this.map);
this.marks.push(mark); this.marks.push(mark);
} }
} }
...@@ -714,22 +721,40 @@ export class NoiseCompComponent implements OnInit { ...@@ -714,22 +721,40 @@ export class NoiseCompComponent implements OnInit {
this.formData.append("thumbnail", file); this.formData.append("thumbnail", file);
} }
} }
generate_geojson(){
this.geojson = {};
this.geojson['type'] = 'FeatureCollection';
this.geojson['features'] = [];
for (let j=0;j<this.marks.length;j++){
let mark:L.CircleMarker = <L.CircleMarker>this.marks[j];
let feature = {};
feature['type'] = 'Feature';
feature['properties'] = {'value': mark['value']};
feature['geometry'] = {};
feature['geometry']['type'] = 'Point';
console.log(mark.getLatLng());
feature['geometry']['coordinates'] = [mark.getLatLng()['lng'],mark.getLatLng()['lat']];
this.geojson['features'].push(feature);
}
}
upload_geojson(){ upload_geojson(){
console.log("upload_geojson::: clicked"); console.log("upload_geojson::: clicked");
/*
var fg = L.featureGroup(); var fg = L.featureGroup();
this.map.eachLayer((layer)=>{ this.map.eachLayer((layer)=>{
if( layer instanceof L.Path || layer instanceof L.Marker){ if( layer instanceof L.Path || layer instanceof L.Marker){
fg.addLayer(layer); fg.addLayer(layer);
} }
}); });
console.log(fg.toGeoJSON()); console.log(fg.toGeoJSON());*/
let geojson = fg.toGeoJSON(); this.generate_geojson();
//console.log(JSON.stringify(this.marks));
let dt = new Date(); let dt = new Date();
let sel = document.getElementById('comps_combo') as HTMLSelectElement; let sel = document.getElementById('comps_combo') as HTMLSelectElement;
let name = "noise_computation_"+sel.value+"_"+dt.getTime(); let name = "noise_computation_"+sel.value+"_"+dt.getTime();
console.log("upload_geojson::: name="+name); console.log("upload_geojson::: name="+name);
this.putGeoJSONService.putGeoJSON(geojson,name,this.city).subscribe( console.log("upload_geojson::: this.geojson="+JSON.stringify(this.geojson));
this.putGeoJSONService.putGeoJSON(this.geojson,name,this.city).subscribe(
res => { res => {
document.getElementById('nameNGJ').innerHTML = name; document.getElementById('nameNGJ').innerHTML = name;
document.getElementById('newNewGeoJSONModal').style.display = "block"; document.getElementById('newNewGeoJSONModal').style.display = "block";
...@@ -758,10 +783,16 @@ export class NoiseCompComponent implements OnInit { ...@@ -758,10 +783,16 @@ export class NoiseCompComponent implements OnInit {
let filename = document.getElementById('nameNGJ').innerHTML; let filename = document.getElementById('nameNGJ').innerHTML;
console.log("process_newgeojson::: filename="+filename); console.log("process_newgeojson::: filename="+filename);
console.log("process_newgeojson::: should call to end point"); console.log("process_newgeojson::: should call to end point");
let conf = {};
conf["layer_id"] = 0;
conf["title_layer_predicted"] = filename;
conf["description_layer_predicted"] = filename;
conf["geojson_layer_predicted"] = this.geojson;
document.getElementById("newNewGeoJSONModal").style.display = "none"; document.getElementById("newNewGeoJSONModal").style.display = "none";
} }
closenewNewGeoJSONModal(){ closenewNewGeoJSONModal(){
console.log('closenewNewGeoJSONModal::: in routine...');
document.getElementById("newNewGeoJSONModal").style.display = "none"; document.getElementById("newNewGeoJSONModal").style.display = "none";
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment