public Bitmap GetImage(TileQuery query) { int tileX = query.X; int tileY = query.Y; int zoom = query.Z; int nwX; int nwY; double nwLat; double nwLon; double seLat; double seLon; BingMapsTileSystem.TileXYToPixelXY(tileX, tileY, out nwX, out nwY); BingMapsTileSystem.PixelXYToLatLong(nwX, nwY, zoom, out nwLat, out nwLon); BingMapsTileSystem.PixelXYToLatLong(nwX + 256, nwY + 256, zoom, out seLat, out seLon); double res = BingMapsTileSystem.GroundResolution(seLat + (nwLat - seLat) / 2d, zoom); int numDigits = BingMapsTileSystem.UsefulDigits(res); BoundingBox bbox = new BoundingBox(nwLon, seLat, seLon, nwLat); return(GetImage( new BoundingBoxQuery() { BBox = bbox, _querytables = query._querytables, Width = 256, Height = 256, SRID = 4326, IsBench = query.IsBench } )); }
public GeoJsonResult GetGeoJsonData(BingTileQuery query) { int tileX; int tileY; int zoom; int nwX; int nwY; double nwLat; double nwLon; double seLat; double seLon; BingMapsTileSystem.QuadKeyToTileXY(query.quadKey, out tileX, out tileY, out zoom); BingMapsTileSystem.TileXYToPixelXY(tileX, tileY, out nwX, out nwY); BingMapsTileSystem.PixelXYToLatLong(nwX, nwY, zoom, out nwLat, out nwLon); BingMapsTileSystem.PixelXYToLatLong(nwX + 256, nwY + 256, zoom, out seLat, out seLon); double res = BingMapsTileSystem.GroundResolution(seLat + (nwLat - seLat) / 2d, zoom); int numDigits = BingMapsTileSystem.UsefulDigits(res); object bbox = null; if (useGeography) { bbox = SqlServerModel.GeograhyFromBoundingBoxNwSe(nwLat, nwLon, seLat, seLon, 4326); } else { bbox = SqlServerModel.GeometryFromBoundingBoxNwSe(nwLat, nwLon, seLat, seLon, 4326); } return(GetGeoJsonData( new BoundingBoxQuery() { useGeography = useGeography, Box = bbox, Resolution = res, NumDigits = numDigits, Tables = query.Tables } )); }