Инструменты пользователя

Инструменты сайта


start

Blog

Карта для определения высоты местности и профиля высот

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" style="height:100%">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Карта для определения высоты местности и построения профиля высот
</title>
<script charset="UTF-8" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA0cIEtC1CH5vPwMOUSNwrGxROPR81K7-tAPRd2E9mEK9o2rB4OhSmEsdYIbr-h01XrRSlW_WFTMoY0g" type="text/javascript"></script>
<script type="text/javascript" src="http://topocoding.com/api/getapi_v1.php?key=FXBNTRNTVXPLAJE"></script>
</head>
<body onload="initPage();" onunload="GUnload();">
<h4>Карта для определения высоты местности и профиля высот</h4> Выберите 2 точки на карте, а затем нажмите кнопку
<Нарисовать профиль высот>.
&nbsp;<div id="map" style="width:100%; height:450px;">
</div>
 
<INPUT TYPE=button VALUE="Нарисовать профиль высот" ONCLICK="updateGraph()">
<INPUT TYPE=button VALUE="Удалить последнюю точку" ONCLICK="undoPoint()">
<select STYLE="font-family : monospace;" name="loc" id="loc" style="code"">
<option>
</option>
</select> &nbsp;
<div id="graph">
</div>
 
<script type="text/javascript">
//<![CDATA[
var mapDiv;
var map;
var points = new Array();
var coordinates = new Array();
function updateGraph()
{
if ( coordinates.length < 2 )
alert( 'Кликните на карту, чтобы выбрать точку.' );
else
topoDrawGraph( document.getElementById("graph"), coordinates );
}
function redrawPath()
{
map.clearOverlays();
if ( points.length > 0 )
{
var lastMarker = new GMarker( points[ points.length - 1 ] );
map.addOverlay( lastMarker );
if ( points.length > 1 )
{
map.addOverlay( new GMarker( points[ 0 ] ) );
var polyLine = new GPolyline(points);
map.addOverlay( polyLine );
}
topoGetAltitude( points[ points.length - 1 ].lat(), points[ points.length - 1 ].lng(), function( altitude ) {
lastMarker.openInfoWindowHtml("Высота = <b>" + altitude + "</b> m");
} );
}
}
function undoPoint()
{
if ( points.length > 0 )
{
points.length = points.length - 1;
coordinates.length = coordinates.length - 1;
redrawPath();
}
}
 
function initMap() {
map = new GMap2(mapDiv, {draggableCursor:"crosshair"});
map.addMapType(G_PHYSICAL_MAP);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(55.6,45.000), 5);
map.enableContinuousZoom();
map.enableScrollWheelZoom();
new GKeyboardHandler(map);
map.hideControls();
GEvent.addListener(map, "click", function(overlay, point) {
if (! overlay) {
points[ points.length ] = point;
coordinates[ coordinates.length ] = [ point.lat(), point.lng() ];
redrawPath();
}
});
 
GEvent.addListener(map, "mouseover", function(){
map.showControls();
});
GEvent.addListener(map, "mouseout", function(){
map.hideControls();
});
/****************************************************************
Added topocoding service by Dmitry Dmitriev, RA3AQ
17th june 2008
****************************************************************/
/****************************************************************
Maidenhead script is (C) Nov 2005 by Laurent Haas F6FVY
You can copy or use this script by naming the author.
****************************************************************/
/**********************************************************
Upgraded to Google Maps API Version 2 in October 2006
by Jari Perki?m?ki OH6BG,
Kudos to F6FVY for the original code.
**********************************************************/
GEvent.addListener(map, 'mousemove', function(point) {
var longDir;
if (point.x < 0)
longDir = "W"
else
longDir = "E";
var latDir;
if (point.y < 0)
latDir = "S"
else
latDir = "N";
var stra = "";
var ychr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var ynum = "0123456789";
var yqth, yi, yk, ydiv, yres, ylp, y;
var y = 0;
var ycalc = new Array(0,0,0);
var yn = new Array(0,0,0,0,0,0,0);
ycalc[1] = point.x + 180;
ycalc[2] = point.y + 90;
for (yi = 1; yi < 3; ++yi) {
for (yk = 1; yk < 4; ++yk) {
if (yk != 3) {
if (yi == 1) {
if (yk == 1) ydiv = 20;
if (yk == 2) ydiv = 2;
}
if (yi == 2) {
if (yk == 1) ydiv = 10;
if (yk == 2) ydiv = 1;
}
yres = ycalc[yi] / ydiv;
ycalc[yi] = yres;
if (ycalc[yi]>0)
ylp = Math.floor(yres)
else
ylp = Math.ceil(yres);
ycalc[yi] = (ycalc[yi] - ylp) * ydiv;
}
else {
if (yi == 1)
ydiv = 12
else
ydiv = 24;
yres = ycalc[yi] * ydiv;
ycalc[yi] = yres;
if (ycalc[yi]> 0)
ylp = Math.floor(yres)
else
ylp = Math.ceil(yres);
}
++y;
yn[y] = ylp;
}
}
yqth = ychr.charAt(yn[1]) + ychr.charAt(yn[4]) + ynum.charAt(yn[2]);
yqth += ynum.charAt(yn[5]) + ychr.charAt(yn[3])+ ychr.charAt(yn[6]);
stra += yqth+", ";
stra += (Math.round(point.y * 10000)/10000).toFixed(4) + " " + latDir;
stra += ", ";
stra += (Math.round(point.x * 10000) / 10000).toFixed(4) + " " + longDir;
document.getElementById("loc").options[0].text = stra;
});
} // initMap
function letsgo() {
map.clearOverlays();
lng = parseFloat(document.getElementById("mene").value.split(",")[1]);
lat = parseFloat(document.getElementById("mene").value.split(",")[0]);
map.setCenter(new GLatLng(lat,lng), 9);
map.setMapType(G_SATELLITE_MAP);
map.addOverlay(new GMarker(new GLatLng(lat,lng)));
var longDir;
if (lng < 0)
longDir = "W"
else
longDir = "E";
var latDir;
if (lat < 0)
latDir = "S"
else
latDir = "N";
var stra = "";
stra += (Math.round(lng * 10000) / 10000).toFixed(4) + " " + longDir;
stra += ", ";
stra += (Math.round(lat * 10000) / 10000).toFixed(4) + " " + latDir;
var ychr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var ynum = "0123456789";
var yqth, yi, yk, ydiv, yres, ylp, y;
var y = 0;
var ycalc = new Array(0,0,0);
var yn = new Array(0,0,0,0,0,0,0);
ycalc[1] = lng + 180;
ycalc[2] = lat + 90;
for (yi = 1; yi < 3; ++yi) {
for (yk = 1; yk < 4; ++yk) {
if (yk != 3) {
if (yi == 1) {
if (yk == 1) ydiv = 20;
if (yk == 2) ydiv = 2;
}
if (yi == 2) {
if (yk == 1) ydiv = 10;
if (yk == 2) ydiv = 1;
}
yres = ycalc[yi] / ydiv;
ycalc[yi] = yres;
if (ycalc[yi]>0)
ylp = Math.floor(yres)
else
ylp = Math.ceil(yres);
ycalc[yi] = (ycalc[yi] - ylp) * ydiv;
}
else {
if (yi == 1)
ydiv = 12
else
ydiv = 24;
yres = ycalc[yi] * ydiv;
ycalc[yi] = yres;
if (ycalc[yi]> 0)
ylp = Math.floor(yres)
else
ylp = Math.ceil(yres);
}
++y;
yn[y] = ylp;
}
}
yqth = ychr.charAt(yn[1]) + ychr.charAt(yn[4]) + ynum.charAt(yn[2]);
yqth += ynum.charAt(yn[5]) + ychr.charAt(yn[3])+ ychr.charAt(yn[6]);
stra += ", " + yqth;
document.getElementById("loc").options[0].text = stra;
}
function gohf() {
map.clearOverlays();
lng = parseFloat(document.getElementById("m").value.split(",")[1]);
lat = parseFloat(document.getElementById("m").value.split(",")[0]);
map.setCenter(new GLatLng(lat,lng),14);
map.setMapType(G_SATELLITE_MAP);
map.addOverlay(new GMarker(new GLatLng(lat,lng)));
//map.showMapBlowup(new GLatLng(lat,lng));
}
function initPage() {
if (GBrowserIsCompatible()) {
_mPreferMetric = true;
mapDiv = document.getElementById("map");
initMap();
} else {
alert('Ваш броузер возможно не поддерживает QTH Locator by Google Maps.\nПосетите http://maps.google.com/\nдля дополнительной информации.');
}
}
//]]>
</script>                
</body>
</html>
2020/07/19 20:00 · prg

Предыдущие записи >>

start.txt · Последние изменения: 2019/03/06 14:17 — prg