summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chimere/static/chimere/js/jquery.chimere.js13
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 c919bb9..f6b29a5 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();
@@ -2824,7 +2822,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));
@@ -2858,7 +2858,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){