Skip to main content
edited tags, corrected typo
Source Link
nmtoken
  • 13.6k
  • 5
  • 38
  • 89

This is how I get feature info from a group layer when clicking on the map (using WMS getFeatureInfoGetFeatureInfo):

let view = this.map.getView()
let viewResolution = view.getResolution();
var source = this.groupLayer.getSource();

var url = source.getGetFeatureInfoUrl(
  this.map.getEventCoordinate(event), 
  viewResolution, 
  view.getProjection(), 
  {'INFO_FORMAT': 'application/json'}
);

this.expedientesService.getExpsClick(url).subscribe(exps => {
  console.log(exps)
})

The problem: This request is returning only one feature even if there are more than one on that clicked point.

The urlURL generated by getGetFeatureInfoUrl has the following format:

http://foo?
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetFeatureInfo&
FORMAT=image%2Fpng&
TRANSPARENT=true&
QUERY_LAYERS=groupLayer&
LAYERS=groupLayer&
INFO_FORMAT=application%2Fjson&
I=50&
J=50&
CRS=EPSG%3Axyz&
STYLES=&
WIDTH=101&
HEIGHT=101&
BBOX=570384.8749920629%2C4722144.92875535%2C570386.7576818952%2C4722146.811445182

(I think I and J are always 50, don't know why)

As seen here If there is more than one feature at the point then it may return information about all the features (up to featureCount) that are there.

Any idea of what is wrong here?

I have an auxiliarauxiliary layer containing all the features, and when making a WFS GetFeature request, multiple features are returned.

This is how I get feature info from a group layer when clicking on the map (using WMS getFeatureInfo):

let view = this.map.getView()
let viewResolution = view.getResolution();
var source = this.groupLayer.getSource();

var url = source.getGetFeatureInfoUrl(
  this.map.getEventCoordinate(event), 
  viewResolution, 
  view.getProjection(), 
  {'INFO_FORMAT': 'application/json'}
);

this.expedientesService.getExpsClick(url).subscribe(exps => {
  console.log(exps)
})

The problem: This request is returning only one feature even if there are more than one on that clicked point.

The url generated by getGetFeatureInfoUrl has the following format:

http://foo?
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetFeatureInfo&
FORMAT=image%2Fpng&
TRANSPARENT=true&
QUERY_LAYERS=groupLayer&
LAYERS=groupLayer&
INFO_FORMAT=application%2Fjson&
I=50&
J=50&
CRS=EPSG%3Axyz&
STYLES=&
WIDTH=101&
HEIGHT=101&
BBOX=570384.8749920629%2C4722144.92875535%2C570386.7576818952%2C4722146.811445182

(I think I and J are always 50, don't know why)

As seen here If there is more than one feature at the point then it may return information about all the features (up to featureCount) that are there.

Any idea of what is wrong here?

I have an auxiliar layer containing all the features, and when making a WFS GetFeature request, multiple features are returned.

This is how I get feature info from a group layer when clicking on the map (using WMS GetFeatureInfo):

let view = this.map.getView()
let viewResolution = view.getResolution();
var source = this.groupLayer.getSource();

var url = source.getGetFeatureInfoUrl(
  this.map.getEventCoordinate(event), 
  viewResolution, 
  view.getProjection(), 
  {'INFO_FORMAT': 'application/json'}
);

this.expedientesService.getExpsClick(url).subscribe(exps => {
  console.log(exps)
})

The problem: This request is returning only one feature even if there are more than one on that clicked point.

The URL generated by getGetFeatureInfoUrl has the following format:

http://foo?
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetFeatureInfo&
FORMAT=image%2Fpng&
TRANSPARENT=true&
QUERY_LAYERS=groupLayer&
LAYERS=groupLayer&
INFO_FORMAT=application%2Fjson&
I=50&
J=50&
CRS=EPSG%3Axyz&
STYLES=&
WIDTH=101&
HEIGHT=101&
BBOX=570384.8749920629%2C4722144.92875535%2C570386.7576818952%2C4722146.811445182

(I think I and J are always 50, don't know why)

As seen here If there is more than one feature at the point then it may return information about all the features (up to featureCount) that are there.

Any idea of what is wrong here?

I have an auxiliary layer containing all the features, and when making a WFS GetFeature request, multiple features are returned.

Source Link
Iñigo
  • 449
  • 4
  • 16

GeoServer WMS GetFeatureInfo only returning one Feature?

This is how I get feature info from a group layer when clicking on the map (using WMS getFeatureInfo):

let view = this.map.getView()
let viewResolution = view.getResolution();
var source = this.groupLayer.getSource();

var url = source.getGetFeatureInfoUrl(
  this.map.getEventCoordinate(event), 
  viewResolution, 
  view.getProjection(), 
  {'INFO_FORMAT': 'application/json'}
);

this.expedientesService.getExpsClick(url).subscribe(exps => {
  console.log(exps)
})

The problem: This request is returning only one feature even if there are more than one on that clicked point.

The url generated by getGetFeatureInfoUrl has the following format:

http://foo?
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetFeatureInfo&
FORMAT=image%2Fpng&
TRANSPARENT=true&
QUERY_LAYERS=groupLayer&
LAYERS=groupLayer&
INFO_FORMAT=application%2Fjson&
I=50&
J=50&
CRS=EPSG%3Axyz&
STYLES=&
WIDTH=101&
HEIGHT=101&
BBOX=570384.8749920629%2C4722144.92875535%2C570386.7576818952%2C4722146.811445182

(I think I and J are always 50, don't know why)

As seen here If there is more than one feature at the point then it may return information about all the features (up to featureCount) that are there.

Any idea of what is wrong here?

I have an auxiliar layer containing all the features, and when making a WFS GetFeature request, multiple features are returned.