Created
March 4, 2013 10:10
-
-
Save nutiteq/5081249 to your computer and use it in GitHub Desktop.
How to have GetFeatureInfo URL for Nutiteq SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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