diff --git a/src/mapboxgl/web-map/WebMapViewModel.ts b/src/mapboxgl/web-map/WebMapViewModel.ts index ceccbc50..c2e2733a 100644 --- a/src/mapboxgl/web-map/WebMapViewModel.ts +++ b/src/mapboxgl/web-map/WebMapViewModel.ts @@ -1685,7 +1685,12 @@ export default class WebMapViewModel extends WebMapBase { return point; } // @ts-ignore - return proj4(sourceProjection, 'EPSG:4326', point); + const coor = proj4(sourceProjection, 'EPSG:4326', point); + const proj = proj4.defs(sourceProjection); + if (proj.axis && proj.axis.indexOf('ne') === 0) { + coor.reverse(); + } + return coor; } private _getMapCenter(mapInfo) { diff --git a/static/libs/json-sql/jsonsql.js b/static/libs/json-sql/jsonsql.js index e54888d6..3f739d53 100644 --- a/static/libs/json-sql/jsonsql.js +++ b/static/libs/json-sql/jsonsql.js @@ -63,22 +63,23 @@ window.jsonsql = { // } // } // fix with -- stric mode - if (this.functionreplaceWith(jsonsql_scope[jsonsql_i], jsonsql_o.where)) { + if (this.functionWith(jsonsql_scope[jsonsql_i], jsonsql_o.where)) { jsonsql_result[jsonsql_rc++] = this.returnFields(jsonsql_scope[jsonsql_i], jsonsql_o.fields); } } return jsonsql_result; }, + functionWith(scope, exp) { + if (!scope) return; - functionreplaceWith: function(scope, exp) { - exp = ' ' + exp.trim(); - let quickRegex = /([\s\+\-\*\/%&\|\^!\*~]\s*?)([a-zA-Z_$][a-zA-Z_$0-9]*?)/g; - exp = exp.replace(quickRegex, (a, b, c) => { - return b + 'scope.' + c; - }); - let func = new Function('scope', 'return ' + exp); - return func(scope); + var resetArgs = ''; + for (var key in scope) { + resetArgs = resetArgs + 'var ' + key + ' = _$_$_functionWith["' + key + '"];'; + } + var nf = new Function('_$_$_functionWith', resetArgs + 'return ' + exp); + + return nf(scope); }, returnFields: function(scope, fields) {