* @return
* @throws IOException
*/
public InputStream getFeatureInfo(DirectPosition2D pos, String infoFormat, int featureCount, GetMapRequest getmap)
throws IOException {
GetFeatureInfoRequest request = wms.createGetFeatureInfoRequest(getmap);
request.setFeatureCount(1);
request.setQueryLayers(new LinkedHashSet<Layer>(layers));
request.setInfoFormat(infoFormat);
request.setFeatureCount(featureCount);
try {
AffineTransform tx = RendererUtilities.worldToScreenTransform(requestedEnvelope,
new Rectangle(width, height));
Point2D dest = new Point2D.Double();
Point2D src = new Point2D.Double(pos.x, pos.y);
tx.transform(src, dest);
request.setQueryPoint((int) dest.getX(), (int) dest.getY());
} catch (Exception e) {
throw (IOException) new IOException("Failed to grab feature info").initCause(e);
}
try {
if(LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Issuing request: " + request.getFinalURL());
}
GetFeatureInfoResponse response = wms.issueRequest(request);
return response.getInputStream();
} catch (IOException e) {
throw e;