source: src/webapp/webclient/js/GnuBoat.js@ 17bc29b

0.5 debian/bullseye debian/jessie
Last change on this file since 17bc29b was 17bc29b, checked in by Joachim Langenbach <joachim.langenbach@…>, 9 years ago

First badly working version of THREE.js height rendering

  • Property mode set to 100644
File size: 19.6 KB
Line 
1/*
2
3 Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 MA 02110-1301 USA.
19
20*/
21
22/** @namespace GnuBoat JavaScript namespace */
23var GnuBoat = GnuBoat || {};
24
25/**
26 * @brief Sets the webservice base url, used by any other functions
27 */
28GnuBoat.setServer = function(baseUrl)
29{
30 if(baseUrl.slice(-1) != "/")
31 baseUrl += "/";
32 GnuBoat.private.serverBaseUrl = baseUrl;
33
34 var link = document.createElement("a");
35 link.setAttribute("href", baseUrl);
36 $("#opencpnHint").empty();
37 $("<p>To connect OpenCPN with the GPSD running on this webservice, use <b>"+ link.hostname +":2947</b> and <b>"+ link.hostname +":2597</b> for the messages recieved on NMEA2000 bus.</p>").appendTo("#opencpnHint");
38}
39
40/**
41 * @brief Used to display user messages
42 */
43GnuBoat.displayMessage = function(text)
44{
45 $("#message").clear();
46 $(shutdownHint).appendTo("#message");
47 location.hash = "#messages";
48}
49
50/**
51 * @brief Fetches the data shown in the display area from the webservice
52 */
53GnuBoat.displayDataGet = function()
54{
55 if(GnuBoat.private.serverBaseUrl == null){
56 GnuBoat.displayMessage("No server set/found");
57 return;
58 }
59 var gnuboatApi = GnuBoat.private.serverBaseUrl;
60 $.getJSON(gnuboatApi, GnuBoat.private.displayDataSet);
61};
62
63/**
64 * @brief Gets the metadata of all maps, provided by the tileserver
65 */
66GnuBoat.getMapInfos = function()
67{
68 if(GnuBoat.private.serverBaseUrl == null){
69 GnuBoat.displayMessage("No server set/found");
70 return;
71 }
72 $.getJSON(GnuBoat.private.serverBaseUrl +"tileserver.php?/index.json", GnuBoat.private.mapInfos);
73};
74
75/**
76 * @brief Fetches the list of available logfiles and adds them to the log file download form
77 */
78GnuBoat.logfilesLoad = function()
79{
80 if(GnuBoat.private.serverBaseUrl == null){
81 GnuBoat.displayMessage("No server set/found");
82 return;
83 }
84 $("#logfilesForm").empty();
85 $.getJSON(GnuBoat.private.serverBaseUrl +"?request=logfiles", function(data){
86 if(!Array.isArray(data) || data.length < 1){
87 $("<p>No Logfiles found!</p>").appendTo("#logfilesForm");
88 console.log(data);
89 return;
90 }
91 if(("error" in data) && data["error"] == 1){
92 alert("Failed to upload map: "+ data["errormessage"]);
93 $("#mapTileUploadProgress").hide();
94 $("#mapFileInput").show();
95 return;
96 }
97 $("<select id=\"logfilesSelect\" name=\"logfilesSelected[]\" class=\"pure-input-1\" multiple></select>").appendTo("#logfilesForm");
98 $("<input type=\"submit\" class=\"pure-button pure-button-primary\" name=\"logfilesDownload\" value=\"Download\"/>").appendTo("#logfilesForm");
99 data.forEach(function(value, index){
100 $("<option value=\""+ value +"\">"+ value +"</option>").appendTo("#logfilesSelect");
101 });
102 });
103};
104/**
105 * @brief Sends a shutdown request to the webservice
106 */
107GnuBoat.shutdown = function()
108{
109 if(GnuBoat.private.serverBaseUrl == null){
110 GnuBoat.displayMessage("No server set/found");
111 return;
112 }
113 $.getJSON(GnuBoat.private.serverBaseUrl +"?request=shutdown", function(data){
114 var shutdownTime = data["shutdownstart"];
115 var shutdownDate = Date.parse(shutdownTime);
116 var currentDate = new Date();
117 var shutdownHint = "Shutting down in "+ Math.floor((shutdownDate - currentDate)/1000) +"s at "+ shutdownTime.toLocaleString();
118 if(shutdownTime == -1){
119 shutdownHint = "Failed to initiate shutdown: "+ data["errormessage"];
120 }
121 GnuBoat.displayMessage(shutdownHint);
122 });
123};
124
125/**
126 * @brief Uploads a map and refreshes the maps metadata on success
127 */
128GnuBoat.uploadMap = function(form)
129{
130 if(GnuBoat.private.serverBaseUrl == null){
131 displayMessage("No server set/found");
132 return;
133 }
134 $("#mapFileInput").hide();
135 $("#mapTileUploadProgress").show();
136 $.ajax({
137 type: 'POST',
138 url: GnuBoat.private.serverBaseUrl +'?request=map',
139 data: new FormData($("#mapTileUpload")[0]),
140 contentType: false,
141 processData: false,
142 success: function(data){
143 if(("error" in data) && data["error"] == 1){
144 alert("Failed to upload map: "+ data["errormessage"]);
145 $("#mapTileUploadProgress").hide();
146 $("#mapFileInput").show();
147 return;
148 }
149 alert("Map upload successfully");
150 $("#mapTileUploadProgress").hide();
151 $("#mapFileInput").show();
152 GnuBoat.getMapInfos();
153 },
154 error: function(jqXHR, exception, errorThrown){
155 alert("Failed to upload map (XHR): "+ exception);
156 $("#mapTileUploadProgress").hide();
157 $("#mapFileInput").show();
158 }
159 }).progress(function(e){
160 $("#mapTileUploadProgress").attr({value: e.oloaded, max: e.total});
161 });
162};
163
164/**
165 * @brief Setups up GnuBoat to be able to start() after configured a server with setServer().
166 */
167GnuBoat.initialize = function()
168{
169 $("#mapTileUploadProgress").hide();
170 $("#logfilesReload").click(GnuBoat.logfilesLoad);
171 $("#shutdownButton").click(GnuBoat.shutdown);
172
173 $("#mapTileUpload").validate({
174 rules: {
175 mapFile: {
176 required: true
177 },
178 mapName: {
179 required: true
180 }
181 },
182 submitHandler: function(form){
183 GnuBoat.uploadMap(form);
184 }
185 });
186
187 $("#logfilesForm").validate({
188 rules: {
189 logfilesSelect: {
190 required: true
191 },
192 }
193 });
194
195 $("#3dchart").empty();
196 var width = $("#3dchart").width();
197 var height = $("#3dchart").height();
198
199 var fieldOfView = 75;
200
201 GnuBoat.private.renderScene = new THREE.Scene();
202// var aspect = width/height;
203// var distance = 1000;
204// GnuBoat.private.renderCamera = new THREE.OrthographicCamera(-distance * aspect, distance * aspect, distance, -distance, 0.1, 1000000);
205// GnuBoat.private.renderCamera.up = new THREE.Vector3(0, 0, 1);
206// GnuBoat.private.renderCamera.position.set(-1, -1, distance);
207// GnuBoat.private.renderCamera.lookAt(GnuBoat.private.renderScene.position);
208
209 GnuBoat.private.renderCamera = new THREE.PerspectiveCamera(75, width/height, 0.1, 1000000);
210 GnuBoat.private.renderCamera.up = new THREE.Vector3(0, 0, 1);
211 GnuBoat.private.renderCamera.position.set(-0.01, -0.01, 15000);
212 GnuBoat.private.renderCamera.lookAt(GnuBoat.private.renderScene.position);
213
214 GnuBoat.private.renderRenderer = new THREE.WebGLRenderer();
215 GnuBoat.private.renderRenderer.setSize(width, height);
216 GnuBoat.private.renderRenderer.setClearColor(0xEEEEEE);
217 document.getElementById("3dchart").appendChild(GnuBoat.private.renderRenderer.domElement);
218
219 GnuBoat.private.animate();
220}
221
222/**
223 * @brief Starts querying the webservice
224 *
225 * Call initialize() and setServer() before start()
226 */
227GnuBoat.start = function()
228{
229 if(GnuBoat.private.serverBaseUrl == null){
230 GnuBoat.displayMessage("No server set/found");
231 return;
232 }
233
234 GnuBoat.getMapInfos();
235 GnuBoat.displayDataGet();
236 if(GnuBoat.private.timerDisplay == null)
237 GnuBoat.private.timerDisplay = setInterval(GnuBoat.displayDataGet, 10000);
238 GnuBoat.logfilesLoad();
239}
240
241/**
242 * @brief Stops querying the webservice
243 */
244GnuBoat.stop = function()
245{
246 if(GnuBoat.private.timerDisplay != null){
247 clearInterval(GnuBoat.private.timerDisplay);
248 GnuBoat.private.timerDisplay = null;
249 }
250}
251
252/**
253 * @brief Private methods and properties of GnuBoat
254 */
255GnuBoat.private = {
256 map: null,
257 mapLayerCurrent: null,
258 mapPolylines: [],
259 mapControl: null,
260 mapsMetadata: null,
261 mapBounds: null,
262 dataMappings: {
263 speedthroughwater: {display: true, map: true, mapActive: false, titleLong: "Speed Through Water", titleShort: "STW", unit: "kts"},
264 speedoverground: {display: true, map: true, mapActive: false, titleLong: "Speed Over Ground", titleShort: "SOG", unit: "kts"},
265 waterdepth: {display: true, map: true, mapActive: true, titleLong: "Waterdepth", titleShort: "Depth", unit: "m"},
266 watertemperature: {display: true, map: true, mapActive: false, titleLong: "Watertemperature", titleShort: "Water", unit: "°C"},
267 gpsfix: {display: true, map: false, mapActive: false, titleLong: "GPS Fix", titleShort: "Fix", unit: ""},
268 },
269 serverBaseUrl: null,
270 timerDisplay: null,
271 renderScene: null,
272 renderCamera: null,
273 renderRenderer: null,
274 renderGeometry: null,
275 renderMaterial: null,
276 renderCube: null,
277 renderMapBounds: null,
278 renderGrid: null,
279
280 openLink: function(target)
281 {
282 window.location=target;
283 },
284
285 displayDataSet: function(data)
286 {
287 var keysDisplay = [];
288 for(var key in GnuBoat.private.dataMappings){
289 if(GnuBoat.private.dataMappings[key]["display"] === true)
290 keysDisplay.push(key);
291 }
292 if(!Array.isArray(data) && !(data instanceof Object)){
293 console.log("No data array returned!");
294 console.log(data);
295 return;
296 }
297 if(!("lastvalid" in data)){
298 console.log("No last valid values given!");
299 }
300 else{
301 var lastValid = data["lastvalid"];
302 for(var i = 0; i < keysDisplay.length; i++){
303 var key = keysDisplay[i];
304 var value = lastValid[key];
305 if($.isNumeric(value)){
306 var text = value.toFixed(1);
307 if(key == "watertemperature"){
308 text = value.toFixed(0);
309 }
310 $("#display #"+ key +" #value").text(text);
311 }
312 else if(key == "gpsfix"){
313 $("#display #"+ key +" #value").text(value);
314 }
315 }
316 }
317
318 if(!("track" in data)){
319 console.log("No track given!");
320 }
321 else{
322 if(GnuBoat.private.map == null){
323 console.log("No map in use");
324 }
325 else{
326 var track = data["track"];
327 var maximas = [];
328 var minimas = [];
329 var points = [];
330 var densityPoints = [];
331
332 var keysMap = [];
333 for(var key in GnuBoat.private.dataMappings){
334 if(GnuBoat.private.dataMappings[key]["map"] === true)
335 keysMap.push(key);
336 }
337 for(var i = 0; i < keysMap.length; i++){
338 if(keysMap[i] == "gpsfix")
339 continue;
340 points[keysMap[i]] = [];
341 }
342
343 // getting maximas, minimums for normalization and the tracks themselves
344 for(var time in track){
345 for(var i = 0; i < keysMap.length; i++){
346 var key = keysMap[i];
347 if(key == "gpsfix")
348 continue;
349 if(!(key in maximas))
350 maximas[key] = track[time][key]
351 else if(maximas[key] < track[time][key])
352 maximas[key] = track[time][key];
353 if(!(key in minimas))
354 minimas[key] = track[time][key]
355 else if(minimas[key] > track[time][key])
356 minimas[key] = track[time][key];
357 points[key].push(new L.latLng(track[time]["latitude"], track[time]["longitude"], track[time][key]));
358 densityPoints.push({latitude: track[time]["latitude"], longitude: track[time]["longitude"], depth: track[time]["waterdepth"]});
359 }
360 }
361 for(var i = 0; i < keysMap.length; i++){
362 var key = keysMap[i];
363 if(key == "gpsfix")
364 continue;
365 if(points[key].length > 0){
366 if(key in GnuBoat.private.mapPolylines){
367 GnuBoat.private.mapPolylines[key].setLatLngs(points[key]);
368 }
369 else{
370 GnuBoat.private.mapPolylines[key] = L.hotline(points[key], {weight: 3, outlineWidth: 0, min: minimas[key], max: maximas[key]});
371 if(GnuBoat.private.mapControl){
372 var name = GnuBoat.private.dataMappings[key]["titleLong"] +" in "+ GnuBoat.private.dataMappings[key]["unit"] +" ("+ GnuBoat.private.dataMappings[key]["titleShort"] +")";
373 GnuBoat.private.mapControl.addOverlay(GnuBoat.private.mapPolylines[key], name);
374 }
375 if(GnuBoat.private.dataMappings[key]["mapActive"] === true)
376 GnuBoat.private.mapPolylines[key].addTo(GnuBoat.private.map);
377 }
378 }
379 }
380 GnuBoat.private.drawDensityEstimation(densityPoints, maximas["waterdepth"]);
381 }
382 }
383 },
384
385 mapSetup: function ()
386 {
387 var mapMetadataIndex = $("#mapSelect").val();
388 if(GnuBoat.private.mapsMetadata == null){
389 console.log("No mapsMetadata set");
390 return;
391 }
392 if(mapMetadataIndex < 0 || mapMetadataIndex >= GnuBoat.private.mapsMetadata.length){
393 console.log("Map metadata is outside of range :"+ mapMetadataIndex.toString());
394 console.log(mapsMetadata);
395 return;
396 }
397 var mapMetadata = GnuBoat.private.mapsMetadata[mapMetadataIndex];
398
399 var latitudeTop = mapMetadata["bounds"][3];
400 var latitudeBottom = mapMetadata["bounds"][1];
401 var longitudeLeft = mapMetadata["bounds"][0];
402 var longitudeRight = mapMetadata["bounds"][2];
403
404 var mapZoomMin = mapMetadata["minzoom"];
405 var mapZoomMax = mapMetadata["maxzoom"];
406
407 var latitudeCenter = (latitudeTop - latitudeBottom)/2 + latitudeBottom;
408 var longitudeCenter = (longitudeLeft - longitudeRight)/2 + longitudeRight;
409 var mapZoomStart = (mapZoomMax - mapZoomMin)/2 + mapZoomMin;
410
411 GnuBoat.private.mapBounds = new L.LatLngBounds(
412 new L.LatLng(latitudeBottom, longitudeLeft),
413 new L.LatLng(latitudeTop, longitudeRight));
414
415 if(GnuBoat.private.map == null){
416 // only initialize the map (viewport) once
417 GnuBoat.private.map = L.map('mapViewport');
418 }
419 GnuBoat.private.map.setView([latitudeCenter, longitudeCenter], mapZoomStart);
420
421 if(GnuBoat.private.mapLayerCurrent != null){
422 GnuBoat.private.map.removeLayer(GnuBoat.private.mapLayerCurrent);
423 if(GnuBoat.private.mapControl)
424 GnuBoat.private.mapControl.removeLayer(GnuBoat.private.mapLayerCurrent);
425 GnuBoat.private.mapLayerCurrent = null;
426 }
427 GnuBoat.private.mapLayerCurrent = L.tileLayer(mapMetadata["tiles"][0], {
428 minZoom: mapZoomMin, maxZoom: mapZoomMax,
429 bounds: GnuBoat.private.mapBounds,
430 attribution: mapMetadata["name"],
431 opacity: 0.85
432 }).addTo(GnuBoat.private.map);
433 if(GnuBoat.private.mapControl != null)
434 GnuBoat.private.mapControl.addBaseLayer(GnuBoat.private.mapLayerCurrent, "Map");
435 else{
436 GnuBoat.private.mapControl = L.control.layers({"Map": GnuBoat.private.mapLayerCurrent}, GnuBoat.private.mapOverlaysToList(), {hideSingleBase: true, sortLayers: true, }).addTo(GnuBoat.private.map);
437 }
438
439 // configure render scene for new map
440 GnuBoat.private.renderSetupMap();
441 },
442
443 mapInfos: function(data)
444 {
445 GnuBoat.private.mapsMetadata = data;
446
447 $("#mapSelect").empty();
448 var selected = "selected";
449 data.forEach(function(value, index){
450 $("<option value=\""+ index.toString() +"\" "+ selected +">"+ value["name"] +"</option>").appendTo("#mapSelect");
451 selected = "";
452 });
453
454 GnuBoat.private.mapSetup();
455 $("#mapSelect").change(function(){ mapSetup(); });
456 },
457
458 mapOverlaysToList: function()
459 {
460 var overlays = {};
461 for(var key in GnuBoat.private.mapPolylines){
462 overlays[key] = GnuBoat.private.mapPolylines[key];
463 }
464 return overlays;
465 },
466
467 renderSetupMap: function()
468 {
469 if(GnuBoat.private.mapBounds == null)
470 return;
471
472 // add map bounds
473 if(GnuBoat.private.renderMapBounds != null)
474 GnuBoat.private.renderScene.remove(GnuBoat.private.renderMapBounds);
475 var m1 = GnuBoat.private.mercator(GnuBoat.private.mapBounds.getSouth(), GnuBoat.private.mapBounds.getWest());
476 var m2 = GnuBoat.private.mercator(GnuBoat.private.mapBounds.getSouth(), GnuBoat.private.mapBounds.getEast());
477 var m3 = GnuBoat.private.mercator(GnuBoat.private.mapBounds.getNorth(), GnuBoat.private.mapBounds.getEast());
478 var m4 = GnuBoat.private.mercator(GnuBoat.private.mapBounds.getNorth(), GnuBoat.private.mapBounds.getWest());
479 var geometryMapBounds = new THREE.Geometry();
480 var materialMapBounds = new THREE.LineBasicMaterial({color: 0x000000, linewidth: 1});
481 // z is greator 0, to draw the map boundings over the grid
482 var vertex = new THREE.Vector3(0, 0, 2);
483 geometryMapBounds.vertices.push(vertex);
484 vertex = new THREE.Vector3(m2.x - m1.x, m2.y - m1.y, 2);
485 geometryMapBounds.vertices.push(vertex);
486 vertex = new THREE.Vector3(m3.x - m1.x, m3.y - m1.y, 2);
487 geometryMapBounds.vertices.push(vertex);
488 vertex = new THREE.Vector3(m4.x - m1.x, m4.y - m1.y, 2);
489 geometryMapBounds.vertices.push(vertex);
490 GnuBoat.private.renderMapBounds = new THREE.LineLoop(geometryMapBounds, materialMapBounds);
491 GnuBoat.private.renderScene.add(GnuBoat.private.renderMapBounds);
492
493// var geometry = new THREE.Geometry();
494// geometry.vertices.push(new THREE.Vector3(0, 0, 4));
495// geometry.vertices.push(new THREE.Vector3(1000, 0, 4));
496// var line = new THREE.Line(geometry, new THREE.LineBasicMaterial({color: 0xFF0000}));
497// GnuBoat.private.renderScene.add(line);
498//
499// geometry = new THREE.Geometry();
500// geometry.vertices.push(new THREE.Vector3(0, 0, 4));
501// geometry.vertices.push(new THREE.Vector3(0, 1000, 4));
502// line = new THREE.Line(geometry, new THREE.LineBasicMaterial({color: 0x0000FF}));
503// GnuBoat.private.renderScene.add(line);
504//
505// geometry = new THREE.Geometry();
506// geometry.vertices.push(new THREE.Vector3(0, 0, 4));
507// geometry.vertices.push(new THREE.Vector3(0, 0, 1000));
508// line = new THREE.Line(geometry, new THREE.LineBasicMaterial({color: 0x00FF00}));
509// GnuBoat.private.renderScene.add(line);
510
511 // add 500m grid
512 if(GnuBoat.private.renderGrid != null)
513 GnuBoat.private.renderScene.remove(GnuBoat.private.renderGrid);
514 geometryMapBounds.computeBoundingBox();
515 var maxLength = Math.max(geometryMapBounds.boundingBox.getSize().x, geometryMapBounds.boundingBox.getSize().y);
516 GnuBoat.private.renderGrid = new THREE.GridHelper(maxLength, Math.round(maxLength / 500.0), 0xDDDDDD, 0xDDDDDD);
517 GnuBoat.private.renderGrid.geometry.rotateX( Math.PI / 2 );
518 GnuBoat.private.renderGrid.translateX(maxLength / 2.0);
519 GnuBoat.private.renderGrid.translateY(maxLength / 2.0);
520 GnuBoat.private.renderScene.add(GnuBoat.private.renderGrid);
521
522 var distance = 0.3 * maxLength;
523 var fieldOfView = 2 * Math.atan(maxLength / (2.0 * distance) ) * 180.0 / Math.PI;
524 GnuBoat.private.renderCamera.position.set(0.1 * maxLength, 0.2 * maxLength, 0.3 * maxLength);
525 GnuBoat.private.renderCamera.fov = fieldOfView;
526 GnuBoat.private.renderCamera.updateProjectionMatrix();
527 },
528
529 drawDensityEstimation: function(densityPoints, maxima)
530 {
531 var material = new THREE.PointsMaterial({color: 0x00CCCC, size: 1});
532 var geometry = new THREE.Geometry();
533 var mercatorSouthWest = {x: 0, y: 0};
534 if(GnuBoat.private.mapBounds != null){
535 mercatorSouthWest = GnuBoat.private.mercator(GnuBoat.private.mapBounds.getSouth(), GnuBoat.private.mapBounds.getWest());
536 }
537
538 for(var i = 0; i < densityPoints.length; i++){
539 var mercator = GnuBoat.private.mercator(densityPoints[i].latitude, densityPoints[i].longitude);
540 var vertex = new THREE.Vector3(mercator.x - mercatorSouthWest.x, mercator.y - mercatorSouthWest.y, (densityPoints[i].depth * -1) + maxima);
541 geometry.vertices.push(vertex);
542 }
543 // point cloud
544 if(GnuBoat.private.renderCloud != null)
545 GnuBoat.private.renderScene.remove(GnuBoat.private.renderCloud);
546 GnuBoat.private.renderCloud = new THREE.Points(geometry, material);
547 GnuBoat.private.renderScene.add(GnuBoat.private.renderCloud);
548 },
549
550 animate: function()
551 {
552 requestAnimationFrame(GnuBoat.private.animate);
553
554// if(GnuBoat.private.mapBounds != null){
555// GnuBoat.private.camera.position.set(GnuBoat.private.mapBounds.getCenter().lng, GnuBoat.private.mapBounds.getSouth(), 0);
556// GnuBoat.private.camera.up = new THREE.Vector3(0, 0, 1);
557// GnuBoat.private.camera.lookAt(new THREE.Vector3(GnuBoat.private.mapBounds.getCenter().lng, GnuBoat.private.mapBounds.getCenter().lat, 0));
558// GnuBoat.private.camera.zoom = 1;
559// }
560
561// var width = $("#3dchart").width();
562// var height = $("#3dchart").height();
563// GnuBoat.private.renderer.setSize(width, height);
564 GnuBoat.private.renderRenderer.render(GnuBoat.private.renderScene, GnuBoat.private.renderCamera);
565 },
566
567 mercator: function(latitude, longitude)
568 {
569 var result = {};
570
571 var earthRadius = 6378137.0;
572
573 result["x"] = longitude / 180.0 * Math.PI * earthRadius;
574 result["y"] = Math.log(Math.tan(latitude / 180.0 * Math.PI / 2.0 + Math.PI / 4.0)) * earthRadius;
575
576 return result;
577 },
578};
Note: See TracBrowser for help on using the repository browser.