Compare commits

..

No commits in common. "974c4dbce57f8716548ccd58e814d9b970715d49" and "f386fd5b4dfe54f4d283fc2e1b095933298efd77" have entirely different histories.

2 changed files with 37 additions and 36 deletions

View File

@ -221,17 +221,8 @@ class Geometry(BaseResource):
polygons.append(p) polygons.append(p)
geojson = { geojson = {
"type": "FeatureCollection", "type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": f"urn:ogc:def:crs:EPSG::{geom.srid}"
}
},
"features": [ "features": [
{ json.loads(x.geojson) for x in polygons
"type": "Feature",
"geometry": json.loads(x.geojson)
} for x in polygons
] ]
} }
return geojson return geojson

View File

@ -394,12 +394,16 @@ netgis.MapOpenLayers.prototype.clearAll = function()
{ {
for ( var i = 0; i < this.layers.length; i++ ) for ( var i = 0; i < this.layers.length; i++ )
{ {
if(this.layers[i] === this.editLayer){
continue;
}
this.map.removeLayer( this.layers[ i ] ); this.map.removeLayer( this.layers[ i ] );
} }
this.layers = []; this.layers = [this.editLayer];
this.snapFeatures.clear(); this.snapFeatures.clear();
this.snapFeatures.push(this.editLayer);
}; };
netgis.MapOpenLayers.prototype.onUpdateStyle = function( e ) netgis.MapOpenLayers.prototype.onUpdateStyle = function( e )
@ -1141,8 +1145,14 @@ netgis.MapOpenLayers.prototype.updateEditLayerItem = function()
netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e ) netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e )
{ {
var json = e; var json = e;
var self = this; var format = new ol.format.GeoJSON();
window.setTimeout( function() { self.createLayerGeoJSON( "Import", json ); }, 10 ); var features = format.readFeatures( json );
this.editLayer.getSource().addFeatures( features );
//this.snapFeatures.push( e.feature );
if ( features.length > 0 )
this.view.fit( this.editLayer.getSource().getExtent(), { padding: [ 40, 40, 40, 40 ] } );
}; };
netgis.MapOpenLayers.prototype.onDragEnter = function( e ) netgis.MapOpenLayers.prototype.onDragEnter = function( e )
@ -1257,7 +1267,6 @@ netgis.MapOpenLayers.prototype.createLayerGeoJSON = function( title, data )
//NOTE: netgis.util.foreach( proj4.defs, function( k,v ) { console.info( "DEF:", k, v ); } ) //NOTE: netgis.util.foreach( proj4.defs, function( k,v ) { console.info( "DEF:", k, v ); } )
var projcode = projection.getCode(); var projcode = projection.getCode();
switch ( projcode ) switch ( projcode )
{ {
case "EPSG:3857": case "EPSG:3857":
@ -1443,6 +1452,7 @@ netgis.MapOpenLayers.prototype.createLayerShapefile = function( title, shapeData
netgis.MapOpenLayers.prototype.addImportedFeatures = function( features ) netgis.MapOpenLayers.prototype.addImportedFeatures = function( features )
{ {
// ToDO: Changes in here problematic on initial data loading
// Add To Edit Layer // Add To Edit Layer
this.editEventsSilent = true; this.editEventsSilent = true;
this.editLayer.getSource().addFeatures( features ); this.editLayer.getSource().addFeatures( features );