-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
executable file
·177 lines (171 loc) · 7.04 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Bing Aerial Imagery Analyzer for OpenStreetMap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
// This is the URL at which the application (and tile.php) is accessible through the internet.
//var baseURL = 'http://lima.schaaltreinen.nl/mvexel/bingimageanalyzer/';
var baseURL = 'http://mvexel.dev.openstreetmap.org/bingimageanalyzer/';
//var baseURL = 'http://localhost/bingimageanalyzer/;
// This is your Bing Maps key. Get your own: http://msdn.microsoft.com/en-us/library/ff428642.aspx
// FOR LIMA.SCHAALTREINEN.NL use only:
// var bingCredentials = "AncYMYJDvHMmYPXT7mJcpCeYxGEVcJFj_StK8PO3ih8WgjvfHzuvnyjc_iRFXqN2";
// FOR MVEXEL.DEV.OPENSTREETMAP.ORG use only:
var bingCredentials = "AmMrXfkYub1DlEAme9Ck0-LLbIXoZxy06Af8uqkrdA-OSIvc3qp6PEj9DP_oz662";
// No need to change anything beyond here
// ==============================================================
var map;
var tilelayer;
// http://stackoverflow.com/questions/901115/get-querystring-values-with-jquery
function getParameterByName( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
function GetMap()
{
var lat=parseFloat(getParameterByName("lat"));
if(isNaN(lat)) lat=52.35;
var lon=parseFloat(getParameterByName("lon"));
if(isNaN(lon)) lon=4.9;
var z=parseInt(getParameterByName("z"));
if(isNaN(z)) z=parseInt(getParameterByName("zoom"));
if(isNaN(z)) z=8;
var nodepth=getParameterByName("nodepth");
var tileSourceUri = baseURL + 'tile.php?t={quadkey}&nodepth=' + nodepth;
//alert(tileSourceUri);
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
{
credentials: bingCredentials,
center: new Microsoft.Maps.Location(lat,lon),
mapTypeId: Microsoft.Maps.MapTypeId.aerial,
zoom: z,
showScalebar: false,
labelOverlay: Microsoft.Maps.LabelOverlay.hidden
}
);
var tileSource = new Microsoft.Maps.TileSource({uriConstructor: tileSourceUri});
tilelayer= new Microsoft.Maps.TileLayer({ mercator: tileSource, opacity: 1 });
map.entities.push(tilelayer);
map.isRotationEnabled(false);
Microsoft.Maps.Events.addHandler(map, 'viewchangeend', function(e){
c=map.getCenter();z=map.getZoom();
potlatchdiv=document.getElementById('edit');
if(potlatchdiv==null) return false;
if(z < 15) {
potlatchdiv.style.color='#aaa';
potlatchdiv.innerHTML='edit in potlatch2';
} else {
potlatchdiv.style.color='#000';
potlatchdiv.innerHTML='<a href="http://open.mapquestapi.com/dataedit/index_flash.html?lat='+c.latitude+'&lon='+c.longitude+'&zoom='+z+'">edit in potlatch2</a>';
}
permalinkspan=document.getElementById('permalink');
if(permalinkspan==null) return false;
permalinkspan.innerHTML='<a href="'+baseURL+'?lat='+c.latitude+'&lon='+c.longitude+'&zoom='+z+'">permalink</a>';
curzoomspan=document.getElementById('curzoom');
if(curzoomspan!=null) curzoomspan.innerHTML=map.getZoom();
});
}
function findName(credentials)
{
map.getCredentials(MakeGeocodeRequest);
document.getElementById('placeInput').select();
}
function MakeGeocodeRequest(credentials)
{
var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations/" + document.getElementById('placeInput').value + "?output=json&jsonp=GeocodeCallback&key=" + credentials;
CallRestService(geocodeRequest);
}
function CallRestService(request)
{
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}
function GeocodeCallback(result)
{
foundName=result.resourceSets[0].resources[0].name;
var ppo={text:foundName,textOffset:new Microsoft.Maps.Point(0,20)};
if (result && result.resourceSets && result.resourceSets.length > 0 && result.resourceSets[0].resources && result.resourceSets[0].resources.length > 0)
{
var bbox = result.resourceSets[0].resources[0].bbox;
var viewBoundaries = Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(bbox[0], bbox[1]), new Microsoft.Maps.Location(bbox[2], bbox[3]));
map.setView({ bounds: viewBoundaries});
}
}
</script>
<script>
$(document).ready(function()
{
$("#slider").slider();
$("#slider").slider( "option", "max", 1 );
$("#slider").slider( "option", "min", 0 );
$("#slider").slider( "option", "step", 0.1 );
$( "#slider" ).slider( "option", "value", 1);
$("#slider").slider({
change: function(event, ui) {
var newopacity = $( "#slider" ).slider( "option", "value" );
tilelayer.setOptions({ opacity: newopacity });
}
});
});
</script>
<style type="text/css">
#slider { margin: 5px 10px 5px 10px; }
#placeInput {width: 90%}
#rest {
position:absolute;
top:0px;
right:0px;
width:130px;
padding:4px;
background-color:white;
opacity:0.8;
font:12px arial;
z-index:100;
text-align:right
}
#edit {
font:bold 12px arial;
}
.box {margin-top:2px;padding:2px;border:1px solid #aaa}
</style>
</head>
<body onload="GetMap();">
<div id='mapDiv' style="position:absolute; width:100%; height:100%;top:0px;left:0px;">
</div>
<div id='rest'>
<a href="about.txt">about this</a><br />
<a href='https://oegeo.wordpress.com/2010/12/03/bing-aerial-photos-for-openstreetmap-great-but-are-they-recent/'>blog post</a> <br />
<a href='http://wiki.openstreetmap.org/wiki/Talk:Bing#Age_of_images'>report an error</a> <br />
<span id='permalink'>permalink</span> <br />
current zoom: <span id=curzoom></span>
<div class=box>
<input id="placeInput" size=13 type="text" onClick=select() onkeydown="if (event.keyCode == 13) findName()" value="Portland" /><br />
<a href="#" onClick=findName()>find</a>
</div>
<div class=box>
<div id="slider"></div>analysis lyr opacity
</div>
<div id='edit' class='box'>
edit in potlatch2
</div>
</div>
<div style='font:10px helvetica, sans-serif;text-align:center;border:1px solid black;background-color:#fff;position:absolute;bottom:35px;right:10px;opacity:0.6;'>
A<br />
<img src="veryfurry4_60.png" height='33' width='60' alt=''><br />
thing
</div>
</body>
</html>