Skip to content

Commit

Permalink
getFeatureInfo under WMS 1.3.0 just no worky
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldzy committed Jan 24, 2025
1 parent 02ff6ab commit 1709052
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 40 deletions.
69 changes: 37 additions & 32 deletions demo/nginx/html/upstreamdownstream.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,45 +278,50 @@ <h2 style="margin-top:0px; margin-bottom: 3px;">CIP Service Upstream/Downstream
}

}

$.ajax({
url: url,
success: function (data, status, xhr) {
var err = typeof data === 'string' ? null : data;
showResults(err, evt.latlng, data);
},
error: function (xhr, status, error) {
showResults(error);
}
});



},

getFeatureInfoUrl: function (latlng) {
var point = this._map.latLngToContainerPoint(latlng, this._map.getZoom());
var size = this._map.getSize();
var point = map.latLngToContainerPoint(latlng,map.getZoom());
var size = map.getSize();
var bounds = map.getBounds();
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();

var params = {
request: 'GetFeatureInfo',
service: 'WMS',
srs: 'EPSG:4326',
styles: this.wmsParams.styles,
transparent: this.wmsParams.transparent,
version: this.wmsParams.version,
format: this.wmsParams.format,
bbox: this._map.getBounds().toBBoxString(),
height: size.y,
width: size.x,
layers: this.wmsParams.layers,
query_layers: this.wmsParams.layers,
info_format: 'text/html'
request: 'GetFeatureInfo'
,service: 'WMS'
,srs: 'EPSG:4326'
,styles: this.wmsParams.styles
,version: "1.1.0"
,bbox: map.getBounds().toBBoxString()
,height: size.y
,width: size.x
,layers: this.wmsParams.layers
,query_layers: this.wmsParams.layers
,info_format: 'application/json'
,x: point.x
,y: point.y
};

params[params.version === '1.3.0' ? 'i' : 'x'] = point.x;
params[params.version === '1.3.0' ? 'j' : 'y'] = point.y;
//params[params.version === '1.3.0' ? 'i' : 'x'] = point.x;
//params[params.version === '1.3.0' ? 'j' : 'y'] = point.y;

var url = this._url + L.Util.getParamString(params, this._url, true);

var url = this._url + L.Util.getParamString(params,this._url,true);

// This replacement is unideal but such is geoserver
if ( url.includes("cipsrv%3Aowld_wqp_src") ) {
url = url.replace(/cipsrv\%3Aowld_wqp_src/g,"cipsrv\%3Aowld_wqp_src_p");
}

if ( url.includes("cipsrv%3Anhdplus_h_flowlines") ) {
url = url.replace(/cipsrv\%3Anhdplus_h_flowlines/g,"cipsrv\%3Anhdplus_h_networknhdflowline");
}

if ( url.includes("cipsrv%3Anhdplus_m_flowlines") ) {
url = url.replace(/cipsrv\%3Anhdplus_m_flowlines/g,"cipsrv\%3Anhdplus_m_networknhdflowline");
}
console.log(url);
return url;

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,36 @@
<string>features</string>
<string>owld_wqp_src_a</string>
</keywords>
<nativeCRS>GEOGCS[&quot;NAD83&quot;,
DATUM[&quot;North American Datum 1983&quot;,
SPHEROID[&quot;GRS 1980&quot;, 6378137.0, 298.257222101, AUTHORITY[&quot;EPSG&quot;,&quot;7019&quot;]],
TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
AUTHORITY[&quot;EPSG&quot;,&quot;6269&quot;]],
PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],
UNIT[&quot;degree&quot;, 0.017453292519943295],
AXIS[&quot;Geodetic longitude&quot;, EAST],
AXIS[&quot;Geodetic latitude&quot;, NORTH],
AUTHORITY[&quot;EPSG&quot;,&quot;4269&quot;]]</nativeCRS>
<srs>EPSG:4269</srs>
<nativeBoundingBox>
<minx>-172.54</minx>
<maxx>23.81</maxx>
<miny>-47.74</miny>
<maxy>86.46</maxy>
<crs>EPSG:4269</crs>
</nativeBoundingBox>
<latLonBoundingBox>
<minx>-180.00000000000003</minx>
<maxx>180.00000000000003</maxx>
<miny>-85.06</miny>
<maxy>85.06</maxy>
<minx>-172.54</minx>
<maxx>23.81</maxx>
<miny>-47.74</miny>
<maxy>86.46</maxy>
<crs>EPSG:4326</crs>
</latLonBoundingBox>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
<enabled>true</enabled>
<metadata>
<entry key="cachingEnabled">false</entry>
</metadata>
<store class="dataStore">
<id>DataStoreInfoImpl-42032311:192d83c2670:-7ff5</id>
</store>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>LayerInfoImpl--7ce8039c:19445fc0d4c:-59ee</id>
<type>VECTOR</type>
<defaultStyle>
<id>StyleInfoImpl--7ce8039c:194431f70d0:-7ffc</id>
<id>StyleInfoImpl--4a49e71b:1948943599e:-4c4f</id>
</defaultStyle>
<resource class="featureType">
<id>FeatureTypeInfoImpl--7ce8039c:19445fc0d4c:-59ef</id>
Expand All @@ -13,4 +13,5 @@
<logoHeight>0</logoHeight>
</attribution>
<dateCreated>2025-01-08 14:18:01.968 UTC</dateCreated>
<dateModified>2025-01-24 14:15:39.256 UTC</dateModified>
</layer>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,24 @@
<string>features</string>
<string>owld_wqp_src_l</string>
</keywords>
<nativeCRS>GEOGCS[&quot;NAD83&quot;,
DATUM[&quot;North American Datum 1983&quot;,
SPHEROID[&quot;GRS 1980&quot;, 6378137.0, 298.257222101, AUTHORITY[&quot;EPSG&quot;,&quot;7019&quot;]],
TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
AUTHORITY[&quot;EPSG&quot;,&quot;6269&quot;]],
PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],
UNIT[&quot;degree&quot;, 0.017453292519943295],
AXIS[&quot;Geodetic longitude&quot;, EAST],
AXIS[&quot;Geodetic latitude&quot;, NORTH],
AUTHORITY[&quot;EPSG&quot;,&quot;4269&quot;]]</nativeCRS>
<srs>EPSG:4269</srs>
<nativeBoundingBox>
<minx>-172.54</minx>
<maxx>23.81</maxx>
<miny>-47.74</miny>
<maxy>86.46</maxy>
<crs>EPSG:4269</crs>
</nativeBoundingBox>
<latLonBoundingBox>
<minx>-172.54</minx>
<maxx>23.81</maxx>
Expand All @@ -20,6 +37,9 @@
</latLonBoundingBox>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
<enabled>true</enabled>
<metadata>
<entry key="cachingEnabled">false</entry>
</metadata>
<store class="dataStore">
<id>DataStoreInfoImpl-42032311:192d83c2670:-7ff5</id>
</store>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>LayerInfoImpl--7ce8039c:19445fc0d4c:-59ec</id>
<type>VECTOR</type>
<defaultStyle>
<id>StyleInfoImpl--7ce8039c:194431f70d0:-7ffc</id>
<id>StyleInfoImpl--4a49e71b:1948943599e:-4c50</id>
</defaultStyle>
<resource class="featureType">
<id>FeatureTypeInfoImpl--7ce8039c:19445fc0d4c:-59ed</id>
Expand All @@ -13,4 +13,5 @@
<logoHeight>0</logoHeight>
</attribution>
<dateCreated>2025-01-08 14:18:22.644 UTC</dateCreated>
<dateModified>2025-01-24 14:15:23.40 UTC</dateModified>
</layer>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>LayerInfoImpl--7ce8039c:19445fc0d4c:-59ea</id>
<type>VECTOR</type>
<defaultStyle>
<id>StyleInfoImpl--7ce8039c:194464c949d:1000</id>
<id>StyleInfoImpl--4a49e71b:1948943599e:-5c75</id>
</defaultStyle>
<resource class="featureType">
<id>FeatureTypeInfoImpl--7ce8039c:19445fc0d4c:-59eb</id>
Expand All @@ -13,5 +13,5 @@
<logoHeight>0</logoHeight>
</attribution>
<dateCreated>2025-01-08 14:18:37.575 UTC</dateCreated>
<dateModified>2025-01-08 15:13:02.49 UTC</dateModified>
<dateModified>2025-01-24 14:15:09.568 UTC</dateModified>
</layer>

0 comments on commit 1709052

Please sign in to comment.