Discussion:
[Geoserver-users] geoserver getGetFeatureInfoUrl 403 error
annalisa
2017-06-15 08:15:51 UTC
Permalink
Hi guy
i'm working with singleclick and i used the following code


map.on('singleclick', function (evt) {


// Attempt to find a marker from the planningAppsLayer
var feature = map.forEachFeatureAtPixel(evt.pixel, function
(feature, layer) {
return feature;
});

if (feature) {

var coord = feature.getGeometry().getCoordinates();
var props = feature.getProperties();
var info = "
" + props.casereference + " <" + props.caseurl + ">
";
info += "<p>" + props.locationtext + "</p>";
info += "<p>Status: " + props.status + " " + props.statusdesc
+ "</p>";
alert(info);


} else {
var view = map.getView();
var viewResolution = view.getResolution();
var url = tiled.getSource().getGetFeatureInfoUrl(
evt.coordinate, viewResolution, view.getProjection(),
{
'INFO_FORMAT': 'application/json',
'propertyName': 'ID,cod_istat',
'STYLES':'point',
'FEATURE_COUNT': 1
});


reqwest({
url: url,
type: 'json',
}).then(function (data) {

var feature = data.features[0];
var props = feature.properties;
var info = "
" + props.ID + "
<p>" + props.cod_istat + "</p>";
alert(info);


});

}

});


the probles is that if a see browser console i receive the following message
when i call the url
OPTIONS
XHR
http://localhost:8080/geoserver/ANANLISA/wms [HTTP/1.1 403 Forbidden 1ms]
meanwhile if a call the url by browser i see the correct result


type "FeatureCollection"
totalFeatures "unknown"
features
0
type "Feature"
id "view_point_1804.fid--51e9cd92_15caaa945f0_-762f"
geometry
properties
ID 37387
cod_istat "057040"
crs


why i'm not able to see the result in my single click event?
I suppose it's a problem of roles but i don't know how to resolve it.

thanks

Annalisa





-----
annalisa
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/geoserver-getGetFeatureInfoUrl-403-error-tp5324305.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Loading...