I'm currently working on developing a Google Maps API implementation that overlays topographic data from USGS Terra Server. I think I have it pretty much under hand except that I can't figure out how to determine the name of the quad, name, & scale for the current tile being served from Terra Server. If you check out this site and zoom into the map that information is being displayed so it must be possible:
http://www.trails.com/topomap.aspx?trailid=fgu003-087
Here are links to some articles which explains more how the images are named by Terra Server:
About MSR Maps
STANDARDIZED DATA SET NAMES FOR DR开发者_JS百科G PRODUCTS
I'm hoping that some geoloc expert out there has already done this and can point me in the right direction. I'd appreciate if you could give me any clues how I might determine this information from the current map view when overlaying the USGS topo data over Google Maps to produce a user experience much like that of the example map about.
Thanks in advance for your help!
You can use the OGC Style Web Map Server Microsoft also hosts. These have a relatively simple lat/lon/scale structure for fetching data, rather than leaving you guessing about the numbers. Here is a url for Aerial. The Scale variable s ranges from 11-21. The t variable lets you choose between Aerial and Topos. Set t=2 for Topos - here is Topo URL.
To get the quad name and map reference etc. You will have to index the topos and build a database. If you have the Topos on a CD and they are in Tiff format you can use GDALTindex to build this index. Beyond this your queries reduce to Point-in-Polygon type, which you can perform using Net Topology Suite.
Since there is no simple intuitive mapping for all the different map-sets and scales, a precomputed index will be the best way to go.
Gdaltindex can index tif files and produce an index in Shapefile format. This can be mapped into MySQL Geometries using Ogr MySQL support.
In the example, the trails.com server is delivering the custom tile images through their own CDN and displaying those tiles over top of Google Maps using a .NET WebHandler.
Since you need the data to come from MSRMaps.com and not [Trails.com][3], you will point the MSRMaps.com WebHandler instead.
Below is how trails is doing it. Replace the getTileUrl
function with something that makes a call to the msrmaps.com server instead, such as MSR Tile Link
var layer = new GTileLayer(new GCopyrightCollection(''), 1, 21);
layer.getTileUrl = function(a, b)
{
var ll = G_NORMAL_MAP.getProjection().fromPixelToLatLng(new GPoint(a.x * 256, (a.y + 1) * 256), b);
var ur = G_NORMAL_MAP.getProjection().fromPixelToLatLng(new GPoint((a.x + 1) * 256, a.y * 256), b);
return "http://cdn-www.trails.com/services/TopoGetGoogleMapTile.ashx?z=" + b + "&style=drgsr&ll=" + ll.y + "," + ll.x + "&ur=" + ur.y + "," + ur.x;
}
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
var mapType = new GMapType([layer], G_NORMAL_MAP.getProjection(), 'Trails', { errorMessage: google.mapError, textColor: "white", linkColor: "white" });
map.addMapType(mapType);
map.setMapType(mapType);
精彩评论