mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Use geoScaleToZoom to calculate zoom in Mapillary, OpenStreetCam
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
|
||||
import rbush from 'rbush';
|
||||
|
||||
import { geoExtent } from '../geo';
|
||||
import { geoExtent, geoScaleToZoom } from '../geo';
|
||||
import { svgDefs } from '../svg';
|
||||
import { utilQsString, utilRebind, utilTiler } from '../util';
|
||||
|
||||
@@ -53,8 +53,7 @@ function maxPageAtZoom(z) {
|
||||
|
||||
|
||||
function loadTiles(which, url, projection) {
|
||||
var s = projection.scale() * 2 * Math.PI;
|
||||
var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
|
||||
var currZoom = Math.floor(geoScaleToZoom(projection.scale()));
|
||||
var tiles = tiler.getTiles(projection, tileZoom);
|
||||
|
||||
// abort inflight requests that are no longer needed
|
||||
|
||||
@@ -21,15 +21,14 @@ import {
|
||||
|
||||
import rbush from 'rbush';
|
||||
|
||||
import { geoExtent } from '../geo';
|
||||
|
||||
import { utilTiler } from '../util';
|
||||
import { geoExtent, geoScaleToZoom } from '../geo';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilQsString,
|
||||
utilRebind,
|
||||
utilSetTransform
|
||||
utilSetTransform,
|
||||
utilTiler
|
||||
} from '../util';
|
||||
|
||||
|
||||
@@ -63,8 +62,7 @@ function maxPageAtZoom(z) {
|
||||
|
||||
|
||||
function loadTiles(which, url, projection) {
|
||||
var s = projection.scale() * 2 * Math.PI;
|
||||
var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
|
||||
var currZoom = Math.floor(geoScaleToZoom(projection.scale()));
|
||||
var tiles = tiler.getTiles(projection, tileZoom);
|
||||
|
||||
// abort inflight requests that are no longer needed
|
||||
|
||||
@@ -81,8 +81,6 @@ function localeTimestamp(s) {
|
||||
* loadTiles() wraps the process of generating tiles and then fetching image points for each tile.
|
||||
*/
|
||||
function loadTiles(which, url, projection, margin) {
|
||||
var s = projection.scale() * 2 * Math.PI;
|
||||
var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0));
|
||||
var tiles = tiler.margin(margin).getTiles(projection, tileZoom);
|
||||
|
||||
// abort inflight requests that are no longer needed
|
||||
@@ -97,14 +95,14 @@ function loadTiles(which, url, projection, margin) {
|
||||
});
|
||||
|
||||
tiles.forEach(function (tile) {
|
||||
loadNextTilePage(which, currZoom, url, tile);
|
||||
loadNextTilePage(which, url, tile);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* loadNextTilePage() load data for the next tile page in line.
|
||||
*/
|
||||
function loadNextTilePage(which, currZoom, url, tile) {
|
||||
function loadNextTilePage(which, url, tile) {
|
||||
var cache = _ssCache[which];
|
||||
var nextPage = cache.nextPage[tile.id] || 0;
|
||||
var id = tile.id + ',' + String(nextPage);
|
||||
@@ -118,7 +116,7 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
// [].shift() removes the first element, some statistics info, not a bubble point
|
||||
bubbles.shift();
|
||||
|
||||
var features = bubbles.map(function (bubble) {
|
||||
var features = bubbles.map(function(bubble) {
|
||||
if (cache.points[bubble.id]) return null; // skip duplicates
|
||||
|
||||
var loc = [bubble.lo, bubble.la];
|
||||
|
||||
Reference in New Issue
Block a user