diff options
-rw-r--r-- | chimere/static/chimere/js/jquery.chimere.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 3d262f9..2cbe36e 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -632,8 +632,6 @@ function transformCoordToLonLat(coord) { target.style.cursor = hit ? 'pointer' : ''; }); - settings.WKT = new ol.format.WKT(); - /* Vectors layer */ settings.vectors = new ol.Collection(); @@ -2820,7 +2818,9 @@ function transformCoordToLonLat(coord) { jQuery(input_id).val(''); return; } - var wkt = settings.WKT.writeFeature(features[0], { + + var WKT = new ol.format.WKT(); + var wkt = WKT.writeFeature(features[0], { dataProjection: EPSG_DISPLAY_PROJECTION, featureProjection: EPSG_PROJECTION}); jQuery(input_id).val(String(wkt)); @@ -2854,7 +2854,12 @@ function transformCoordToLonLat(coord) { }, initFeature: function(wkt_geometry){ if (!wkt_geometry || wkt_geometry == 'None') return; - feature = settings.WKT.readFeature(wkt_geometry, { + var WKT = new ol.format.WKT(); + // remove srid description "SRID=1234;GEOM(...)" if present + if (wkt_geometry.indexOf(';') != -1){ + wkt_geometry = wkt_geometry.substring(wkt_geometry.indexOf(';') + 1); + } + feature = WKT.readFeature(wkt_geometry, { dataProjection: EPSG_DISPLAY_PROJECTION, featureProjection: EPSG_PROJECTION}); if (settings.draw_activated){ |