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

a

parent 13bcf9d4
Branches
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<div class="control_box button_box" id="control_help" style='width:300px;'> <div class="control_box button_box" id="control_help" style='width:300px;'>
<button (click)="openInstructions()"> Help</button> <button (click)="openInstructions()"> Help</button>
<button id="upload_geojson_btn" (click)="upload_geojson();">Upload GEOJSON</button>
<button id="download_run_btn1" (click)="download_geojson();">Download GEOJSON</button> <button id="download_run_btn1" (click)="download_geojson();">Download GEOJSON</button>
<button id="download_run_btn2" (click)="download_matrix();">Download OD Matrix</button> <button id="download_run_btn2" (click)="download_matrix();">Download OD Matrix</button>
</div> </div>
......
...@@ -3,6 +3,7 @@ import * as L from 'leaflet'; ...@@ -3,6 +3,7 @@ import * as L from 'leaflet';
import { ConfigService } from '@ngx-config/core'; import { ConfigService } from '@ngx-config/core';
import { Options, LabelType } from '@angular-slider/ngx-slider'; import { Options, LabelType } from '@angular-slider/ngx-slider';
import { BikeAnalysisAMSService } from '../services/bike-analysis_AMS.service'; import { BikeAnalysisAMSService } from '../services/bike-analysis_AMS.service';
import { PutGeoJsonService } from '../services/put-geojson.service';
import { LeafletLayerDirective } from '@asymmetrik/ngx-leaflet'; import { LeafletLayerDirective } from '@asymmetrik/ngx-leaflet';
@Component({ @Component({
selector: 'ngx-od-from-counts', selector: 'ngx-od-from-counts',
...@@ -13,6 +14,7 @@ export class BikeAnalysisAMSComponent implements OnInit { ...@@ -13,6 +14,7 @@ export class BikeAnalysisAMSComponent implements OnInit {
constructor( constructor(
private configService: ConfigService, private configService: ConfigService,
private putGeoJSONService: PutGeoJsonService,
private bikeAnalysisAMSService: BikeAnalysisAMSService) { } private bikeAnalysisAMSService: BikeAnalysisAMSService) { }
public R_EARTH: number = 6371e3; public R_EARTH: number = 6371e3;
...@@ -603,4 +605,23 @@ export class BikeAnalysisAMSComponent implements OnInit { ...@@ -603,4 +605,23 @@ export class BikeAnalysisAMSComponent implements OnInit {
link.dispatchEvent(evt); link.dispatchEvent(evt);
link.remove(); link.remove();
} }
upload_geojson(){
console.log("upload_geojson::: clicked");
var fg = L.featureGroup();
this.map.eachLayer((layer)=>{
if(layer instanceof L.Path || layer instanceof L.Marker){
fg.addLayer(layer);
}
});
console.log(fg.toGeoJSON());
let geojson = fg.toGeoJSON();
let dt = new Date();
let name = "test_IOP_"+dt.getTime();
console.log("upload_geojson::: name="+name);
this.putGeoJSONService.putGeoJSON(geojson,name).subscribe(
res => {alert('geojson '+name+' added to storage.'); console.log("putGeoJSONService: SUCESS::: res="+JSON.stringify(res))},
err => {alert('ERROR!!!\ngeojson '+name+' NOT added to storage.');console.log("putGeoJSONService: ERROR::: err="+JSON.stringify(err));}
);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment