Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Mapillary vector tiles for images, sequences and map features #8367

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/locales/en.min.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions modules/core/file_fetcher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { utilFetchJson } from '../util/util';
import { json as d3_json } from 'd3-fetch';

let _mainFileFetcher = coreFileFetcher(); // singleton

Expand Down Expand Up @@ -54,7 +54,7 @@ export function coreFileFetcher() {

let prom = _inflight[url];
if (!prom) {
_inflight[url] = prom = utilFetchJson(url)
_inflight[url] = prom = d3_json(url)
.then(result => {
delete _inflight[url];
if (!result) {
Expand Down
26 changes: 14 additions & 12 deletions modules/core/localizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ export function coreLocalizer() {
};

let fileMap = fileFetcher.fileMap();
for (let scopeId in localeDirs) {
let key = `locales_index_${scopeId}`;
fileMap[key] = localeDirs[scopeId] + '/index.min.json';
for (let id in localeDirs) {
let key = `locales_index_${id}`;
fileMap[key] = localeDirs[id] + '/index.min.json';
filesToFetch.push(key);
}

Expand Down Expand Up @@ -126,9 +126,9 @@ export function coreLocalizer() {
});
// We only need to load locales up until we find one with full coverage
_localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
let scopeId = Object.keys(localeDirs)[i];
let directory = Object.values(localeDirs)[i];
if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
let id = Object.keys(localeDirs)[i];
let dir = Object.values(localeDirs)[i];
if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, id, dir));
});
});

Expand Down Expand Up @@ -187,23 +187,25 @@ export function coreLocalizer() {

/* Locales */
// Returns a Promise to load the strings for the requested locale
localizer.loadLocale = (locale, scopeId, directory) => {
localizer.loadLocale = (requested, id, dir) => {

let locale = requested;

// US English is the default
if (locale.toLowerCase() === 'en-us') locale = 'en';

if (_localeStrings[scopeId] && _localeStrings[scopeId][locale]) { // already loaded
if (_localeStrings[id] && _localeStrings[id][locale]) { // already loaded
return Promise.resolve(locale);
}

let fileMap = fileFetcher.fileMap();
const key = `locale_${scopeId}_${locale}`;
fileMap[key] = `${directory}/${locale}.min.json`;
const key = `locale_${id}_${locale}`;
fileMap[key] = `${dir}/${locale}.min.json`;

return fileFetcher.get(key)
.then(d => {
if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
_localeStrings[scopeId][locale] = d[locale];
if (!_localeStrings[id]) _localeStrings[id] = {};
_localeStrings[id][locale] = d[locale];
return locale;
});
};
Expand Down
2 changes: 1 addition & 1 deletion modules/renderer/photos.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function rendererPhotos(context) {
};

photos.shouldFilterByUsername = function() {
return showsLayer('mapillary') || showsLayer('openstreetcam') || showsLayer('streetside');
return showsLayer('openstreetcam') || showsLayer('streetside');
};

photos.showsPhotoType = function(val) {
Expand Down
Loading