From f49828b246659bd21c602f08f12d668573c5b21d Mon Sep 17 00:00:00 2001
From: Hassan Basri <53334450+mrzh4s@users.noreply.github.com>
Date: Fri, 3 Mar 2023 12:10:27 +0000
Subject: [PATCH 1/4] fix style not work func eachfeature in wfs request
---
package-lock.json | 27 +++++++++++++++++++++++++--
src/L.Geoserver.js | 19 ++++++++++---------
2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 6034bb4..cd8320b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,8 +1,31 @@
{
"name": "leaflet-geoserver-request",
- "version": "1.0.3",
- "lockfileVersion": 1,
+ "version": "1.2.2",
+ "lockfileVersion": 2,
"requires": true,
+ "packages": {
+ "": {
+ "name": "leaflet-geoserver-request",
+ "version": "1.2.2",
+ "license": "ISC",
+ "devDependencies": {
+ "jquery": "^3.5.1",
+ "leaflet": "^1.6.0"
+ }
+ },
+ "node_modules/jquery": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
+ "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==",
+ "dev": true
+ },
+ "node_modules/leaflet": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
+ "integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ==",
+ "dev": true
+ }
+ },
"dependencies": {
"jquery": {
"version": "3.5.1",
diff --git a/src/L.Geoserver.js b/src/L.Geoserver.js
index 35b0bca..51796a4 100644
--- a/src/L.Geoserver.js
+++ b/src/L.Geoserver.js
@@ -6,7 +6,7 @@ L.Geoserver = L.FeatureGroup.extend({
transparent: true,
CQL_FILTER: "INCLUDE",
zIndex: 1000,
- version: "1.1.0",
+ version: "1.3.0",
srsname: "EPSG:4326",
attribution: `layer`,
fitLayer: true,
@@ -48,7 +48,7 @@ L.Geoserver = L.FeatureGroup.extend({
data: {
service: "WFS",
- version: "1.1.0",
+ version: "2.0.0",
request: "GetFeature",
typename: this.options.layers,
CQL_FILTER: this.options.CQL_FILTER,
@@ -82,8 +82,9 @@ L.Geoserver = L.FeatureGroup.extend({
if (typeof that.options.style === "function") {
for (i = 0; i < layers.length; i++) {
that.addLayer(layers[i]);
- if (i.setStyle) {
- i.setStyle(that.options.style(i.feature));
+ if (layers[i].setStyle) {
+ // check if setStyle method exists
+ layers[i].setStyle(that.options.style(layers[i].feature));
}
}
} else {
@@ -110,7 +111,7 @@ L.Geoserver = L.FeatureGroup.extend({
var legend = L.control({ position: "bottomleft" });
legend.onAdd = function (map) {
var div = L.DomUtil.create("div", "info Legend");
- var url = `${that.baseLayerUrl}/wms?REQUEST=GetLegendGraphic&VERSION=1.1.0&FORMAT=image/png&LAYER=${that.options.layers}&style=${that.options.style}`;
+ var url = `${that.baseLayerUrl}/wms?REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=image/png&LAYER=${that.options.layers}&style=${that.options.style}`;
div.innerHTML +=
"
Date: Sun, 5 Mar 2023 05:39:59 +0000
Subject: [PATCH 2/4] updating version can be selected
---
package-lock.json | 43 -------------------------------------------
src/L.Geoserver.js | 18 +++++++++++++-----
2 files changed, 13 insertions(+), 48 deletions(-)
delete mode 100644 package-lock.json
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index cd8320b..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "leaflet-geoserver-request",
- "version": "1.2.2",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "leaflet-geoserver-request",
- "version": "1.2.2",
- "license": "ISC",
- "devDependencies": {
- "jquery": "^3.5.1",
- "leaflet": "^1.6.0"
- }
- },
- "node_modules/jquery": {
- "version": "3.5.1",
- "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
- "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==",
- "dev": true
- },
- "node_modules/leaflet": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
- "integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ==",
- "dev": true
- }
- },
- "dependencies": {
- "jquery": {
- "version": "3.5.1",
- "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
- "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==",
- "dev": true
- },
- "leaflet": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
- "integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ==",
- "dev": true
- }
- }
-}
diff --git a/src/L.Geoserver.js b/src/L.Geoserver.js
index 51796a4..8f63ccf 100644
--- a/src/L.Geoserver.js
+++ b/src/L.Geoserver.js
@@ -6,7 +6,7 @@ L.Geoserver = L.FeatureGroup.extend({
transparent: true,
CQL_FILTER: "INCLUDE",
zIndex: 1000,
- version: "1.3.0",
+ version: ["1.1.1","1.3.0"],
srsname: "EPSG:4326",
attribution: `layer`,
fitLayer: true,
@@ -34,6 +34,11 @@ L.Geoserver = L.FeatureGroup.extend({
//wms layer function
wms: function () {
+
+ if (!this.options.version) {
+ this.options.version = '1.1.1';
+ }
+
return L.tileLayer.wms(this.baseLayerUrl, this.options);
},
@@ -42,16 +47,19 @@ L.Geoserver = L.FeatureGroup.extend({
wfs: function () {
var that = this;
+ if (!this.options.version) {
+ this.options.version = '1.1.0';
+ }
//Geoserver Web Feature Service
$.ajax(this.baseLayerUrl, {
type: "GET",
data: {
service: "WFS",
- version: "2.0.0",
+ version: this.options.version,
request: "GetFeature",
typename: this.options.layers,
- CQL_FILTER: this.options.CQL_FILTER,
+ CQL_FILTER: this.options.filter,
srsname: this.options.srsname,
outputFormat: "text/javascript",
format_options: "callback: getJson",
@@ -111,7 +119,7 @@ L.Geoserver = L.FeatureGroup.extend({
var legend = L.control({ position: "bottomleft" });
legend.onAdd = function (map) {
var div = L.DomUtil.create("div", "info Legend");
- var url = `${that.baseLayerUrl}/wms?REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=image/png&LAYER=${that.options.layers}&style=${that.options.style}`;
+ var url = `${that.baseLayerUrl}/wms?REQUEST=GetLegendGraphic&VERSION=${that.options.version}&FORMAT=image/png&LAYER=${that.options.layers}&style=${that.options.style}`;
div.innerHTML +=
"
Date: Sun, 5 Mar 2023 05:43:54 +0000
Subject: [PATCH 3/4] hot fix change WFS CQL_FILTER to default name
---
src/L.Geoserver.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/L.Geoserver.js b/src/L.Geoserver.js
index 8f63ccf..f46bc6f 100644
--- a/src/L.Geoserver.js
+++ b/src/L.Geoserver.js
@@ -59,7 +59,7 @@ L.Geoserver = L.FeatureGroup.extend({
version: this.options.version,
request: "GetFeature",
typename: this.options.layers,
- CQL_FILTER: this.options.filter,
+ CQL_FILTER: this.options.CQL_FILTER,
srsname: this.options.srsname,
outputFormat: "text/javascript",
format_options: "callback: getJson",
From 4b1c85064857dc04537d012b76e24696e2bdcb65 Mon Sep 17 00:00:00 2001
From: Hassan Basri <53334450+mrzh4s@users.noreply.github.com>
Date: Sun, 5 Mar 2023 05:46:19 +0000
Subject: [PATCH 4/4] hot fix version in array change to null
---
src/L.Geoserver.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/L.Geoserver.js b/src/L.Geoserver.js
index f46bc6f..62edf79 100644
--- a/src/L.Geoserver.js
+++ b/src/L.Geoserver.js
@@ -6,7 +6,7 @@ L.Geoserver = L.FeatureGroup.extend({
transparent: true,
CQL_FILTER: "INCLUDE",
zIndex: 1000,
- version: ["1.1.1","1.3.0"],
+ version: "",
srsname: "EPSG:4326",
attribution: `layer`,
fitLayer: true,