Skip to content

Instantly share code, notes, and snippets.

@nutiteq
Created March 4, 2013 10:10
Show Gist options
  • Save nutiteq/5081249 to your computer and use it in GitHub Desktop.
Save nutiteq/5081249 to your computer and use it in GitHub Desktop.
How to have GetFeatureInfo URL for Nutiteq SDK
@Override
public void onMapClicked(double x, double y, boolean longClick) {
// your activity should have getter for the MapView
MapView map = ((TesterMap3DActivity) mapActivity).getMapView();
float zoom = map.getZoom();
double worldSize = 360.0; // for EPSG3857: Math.PI * 6378137.0f * 2.0f;
double tileSizeHalf = worldSize / Math.pow(2,zoom) / 2.0;
double wgsX = (new EPSG3857()).toWgs84(x, y).x;
double wgsY = (new EPSG3857()).toWgs84(x, y).y;
String bbox = (wgsX-tileSizeHalf)+","+(wgsY-tileSizeHalf)+","+(wgsX+tileSizeHalf)+","+(wgsY+tileSizeHalf);
String getFeatureUrl = "http://192.168.1.140:8080/geoserver/wms?request=GetFeatureInfo&service=WMS&version=1.1.1&layers=topp%3Astates&styles=&srs=EPSG%3A4326&format=image%2Fpng&bbox="+bbox+"&width=256&height=256&query_layers=topp%3Astates&info_format=text%2Fhtml&feature_count=50&x=128&y=128&exceptions=application%2Fvnd.ogc.se_xml";
Log.debug(getFeatureUrl);
// TODO: real HTTP request...
}
@nutiteq
Copy link
Author

nutiteq commented Apr 10, 2013

This is obsolete now, as Nutiteq SDK has MapView.worldToMapTile() method. https://github.com/nutiteq/hellomap3d/blob/master/AdvancedMap3D/src/main/java/com/nutiteq/advancedmap/WmsMapActivity.java for a sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment