Map client update #216
@ -221,8 +221,17 @@ 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
|
||||||
|
@ -394,16 +394,12 @@ 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.editLayer];
|
this.layers = [];
|
||||||
|
|
||||||
this.snapFeatures.clear();
|
this.snapFeatures.clear();
|
||||||
this.snapFeatures.push(this.editLayer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
netgis.MapOpenLayers.prototype.onUpdateStyle = function( e )
|
netgis.MapOpenLayers.prototype.onUpdateStyle = function( e )
|
||||||
@ -1145,14 +1141,8 @@ netgis.MapOpenLayers.prototype.updateEditLayerItem = function()
|
|||||||
netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e )
|
netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e )
|
||||||
{
|
{
|
||||||
var json = e;
|
var json = e;
|
||||||
var format = new ol.format.GeoJSON();
|
var self = this;
|
||||||
var features = format.readFeatures( json );
|
window.setTimeout( function() { self.createLayerGeoJSON( "Import", json ); }, 10 );
|
||||||
|
|
||||||
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 )
|
||||||
@ -1267,6 +1257,7 @@ 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":
|
||||||
@ -1452,7 +1443,6 @@ 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 );
|
||||||
|
Loading…
Reference in New Issue
Block a user