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 DRG 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);
Related
SoilGrids provides the mapping of different properties of soil. I have executed their sample code on Google Earth Engine and it's working fine:
var sand_mean = ee.Image('projects/soilgrids-isric/sand_mean')
//print example image metadata and description
print(sand_mean)
//Add all layer to Map
Map.addLayer(sand_mean.select('sand_0-5cm_mean'),{min: 50, max: 1000,palette: ['5d5851','635a4b','6a5b44','715c3d','785e36','7e5f30','856129','8c6222','92641c','996515','a0660e','a66808','ad6901']},'SoilGrids250m 2.0 - Sand content ISRIC_0_5cm')
//Set basemap to Hybrid view
Map.setOptions('HYBRID')
But my question is can we do temporal analysis using soilGrids? I can't find filterDate property. So, is it possible to see the change in the subsequent years (temporal analysis)?
I have a Google Map where I'd like to display some markers etc.
If you open the website, it sets session to "geometrycollection empty". When the map is fully loaded, it makes an AJAX request with NE & SW lat and lng as parameters.
Handle method for AJAX looks like that:
$contain = $this->locationsManager->getContainOfAreas($this->getSession("union")->area, $polygon);
$area = $this->locationsManager->getDifferentiatedArea($polygon, $this->getSession("union")->area);
$coordinates = $this->locationsManager->getLocationsCoordinates($area["polygon"]);
$this->getSession("union")->area = $this->locationsManager->getUnionOfAreas($this->getSession("union")->area, $area["polygon"])["unionArea"];
But when I try to find out if area B ($this->getSession("union")->area - union of areas (viewports) user "visited") contains area A ($polygon - current viewport in Google Maps), it returns wrong results (I drew polygons from the variables via Google Maps Polygons and they were different).
This is SQL command for getting result of getContainOfAreas:
SELECT ST_CONTAINS(ST_GEOMFROMTEXT(?), ST_GEOMFROMTEXT(?)) AS result;
Do you know what I'm doing wrong?
I'm using Google Maps to calculate distances between a user-entered address and our store locations. Once this data is read in, I'd like to use jQuery .tablesorter() to sort the table from closest to furthest store. However, the data read in from Google Maps is not being recognized by the jQuery .tablesorter() function. I tried implementing the setTimeout() suggestion on this thread (JQuery tablesorter appended data not sorting) and numerous other fixes that did not work. I understand what's happening (the DOM not recognizing data written to the page after it's been constructed), but I'm not entirely sure how to fix it. Any ideas? Thanks!
Here's the URL to the test page if you'd like to see what's happening: http://www.gregcklotz.com/Larry/Locations.php
You just need to update the table after adding all of the distance data into the columns:
for (i = 0; i < stores.length; i++)
{
address = new google.maps.LatLng(lat, lng);
coords = new google.maps.LatLng(stores[i].lat, stores[i].long);
distance = (.621371192237334 * google.maps.geometry.spherical.computeDistanceBetween(address, coords)/1000).toFixed(1);
$("tr.store"+stores[i].store+" td:last").text(parseInt(distance));
}
// update the table data
$("table").trigger("update");
map.setCenter(marker.getPosition());
My application create map using Google Maps v3 that have lots of markers and clusters on it, and it works fine.
Same map I have to show also in another browser window, but for some reason it can't (getting only empty map, without markers/clusters on it). I checked error in Firebug, and there is an message:
NetworkError: 414 Request-URI Too Large
So - same maps, in first browser window is ok, in second it is not.
Just to say that I'm opening second map (in second window) by sending parameters about every marker I have on first map, so URL is very long (2700 characters).
Is there some way to solve this? Is it a problem with long url string?
Can you help me with this?
The problem is in the URL you generated. Google specifies a limit of 2000 chars for the passed URL and we should stick with it.
I solved the problem in my application by generating a hash of the URL before passing it over to Google.
1) Create a database table to store your hashes. Columns can be hash, params, timestamp. You can improve your code by deleting hashes older than certain time, keeping the table small and fast.
2) Create a code (my_google_map_helper/get_hash) to generate the hash to be passed to Google and stick it somewhere. I am using PHP, so my code is:
// generate my hash
$hash = sha1(serialize($_GET));
// run an insert ignore into my hashes' table
// get the hash where the hash is $hash
// print my hash
3) Create a code (get_kml) to retrieve the params saved into the database from a given hash
if(isset($_GET['hash'])):
// select params from my hash table where hash = $_GET['hash']
// unserialize the saved params
// generate and return my KML file
endif;
4) Change your JavaScript so it generates the hash before calling the Google function:
$.get('my_google_map_helper/get_hash?' + MY_LONG_PARAMS_LIST, true)
, function(hash){
Polygons = new google.maps.KmlLayer(
{url:'http://my_url/get_kml?hash=' + hash , map:MAP}
);
}
);
Have fun!
I'm looking at the geometry data type in Sql Server 2008 and it looks interesting but the documentation does not seem that good. Would I be able to store cones, cylinders and spheres in the WKT format? These features traditionally have a radius and not hundreds of points.
To the best of my knowledge your are going to have to use an external application to render your shape as a large number of points. See this blog for a technique for rendering circles.
One possibility to consider is a CLR proc to render the shapes you need and a view with indexes. I don't know how well that will perform, but it just might work.
sorry for the late reply. You could always write your own User-Defined-Type called Circle, with two properties namely Centroid and Radius.
Inside the newly formed UDT, create a method that takes the properties Centroid (Point3D), and Radius (Double). After this, create a method that uses both SqlGeometry and SqlGeometryBuilder to build the newly formed object.
First, create a Point instance of Geometry. Inherit the Centroid values from the class object, then, create another Geometry Polygon that's derived from the Point object, and STBuffer(Radius) it.
Below is my example: (written in 30min)
public SqlGeometry ToSQLGeometry()
{
int srid = this.SRID; // i.e. 4326
SqlGeometry geom = new SqlGeometry();
SqlGeometryBuilder gb = new SqlGeometryBuilder();
OpenGisGeometryType pt = OpenGisGeometryType.Point;
gb.SetSrid(srid);
gb.BeginGeometry(pt);
gb.BeginFigure(this.Centroid.X, this.Centroid.Y, this.Centroid.Z, this.Centroid.M);
gb.EndFigure();
gb.EndGeometry();
geom = gb.ConstructedGeometry;
geom = geom.MakeValid(); // Optional for Point data
SqlGeometry geomCircle = new SqlGeometry();
geomCircle = geom.STBuffer(this.Radius);
return geomCircle;
}
When you've done this in VS2010 by using the CLR project type, you can deploy it to your database.
In SQL, you can call the object as such:: Parse(X Y Z M,R)
declare #c Circle
set #c = Circle::Parse('5 6 7 8,2')
select 'Circle', #c.ToString(), #c.ToSQLGeometry()
Had a quick look around and found this MSDN page on Spatial Samples. It covers all the Methods to enter data in WKT, WKB & XML(GML) as well as functions to view the in Human Readable form. It also covers MakeValid, STIsValid & STSrid.
There looks to be a fair few SQL examples that you may find useful