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

Projection expressions #5040

Closed
Closed
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### ✨ Features and improvements
- Support Vertical Perspective projection ([#5023](https://github.com/maplibre/maplibre-gl-js/pull/5023))
- Support projection expression support.
birkskyum marked this conversation as resolved.
Show resolved Hide resolved
- _...Add new stuff here..._

### 🐞 Bug fixes
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@mapbox/unitbezier": "^0.0.1",
"@mapbox/vector-tile": "^1.3.1",
"@mapbox/whoots-js": "^3.1.0",
"@maplibre/maplibre-gl-style-spec": "^21.2.0",
"@maplibre/maplibre-gl-style-spec": "^22.0.0",
"@types/geojson": "^7946.0.14",
"@types/geojson-vt": "3.2.5",
"@types/mapbox__point-geometry": "^0.1.4",
Expand Down
16 changes: 15 additions & 1 deletion src/style/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import {QueryRenderedFeaturesOptions, QueryRenderedFeaturesOptionsStrict, QuerySourceFeatureOptions, queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features';
import {SourceCache} from '../source/source_cache';
import {GeoJSONSource} from '../source/geojson_source';
import {latest as styleSpec, derefLayers as deref, emptyStyle, diff as diffStyles, DiffCommand} from '@maplibre/maplibre-gl-style-spec';
import {latest as styleSpec, derefLayers as deref, emptyStyle, diff as diffStyles, DiffCommand, createExpression} from '@maplibre/maplibre-gl-style-spec';
import {getGlobalWorkerPool} from '../util/global_worker_pool';
import {rtlMainThreadPluginFactory} from '../source/rtl_text_plugin_main_thread';
import {RTLPluginLoadedEventName} from '../source/rtl_text_plugin_status';
Expand Down Expand Up @@ -64,6 +64,7 @@
type GetImagesResponse
} from '../util/actor_messages';
import {Projection} from '../geo/projection/projection';

import {createProjectionFromName} from '../geo/projection/projection_factory';

const empty = emptyStyle() as StyleSpecification;
Expand Down Expand Up @@ -579,6 +580,19 @@
* Apply queued style updates in a batch and recalculate zoom-dependent paint properties.
*/
update(parameters: EvaluationParameters) {

try {
const exprestInt = createExpression(['interpolate', ['linear'], ['zoom'], 10, 'vertical-perspective', 12, 'mercator'], styleSpec.projection.type)
if (exprestInt.result === 'success') {
console.log(exprestInt.value.evaluate({zoom: parameters.zoom}))

} else {
console.warn('Error parsing 22interpolate', exprestInt.result)

Check warning on line 590 in src/style/style.ts

View check run for this annotation

Codecov / codecov/patch

src/style/style.ts#L590

Added line #L590 was not covered by tests
}
} catch (err) {
console.warn('Error parsing 11interpolate', err)

Check warning on line 593 in src/style/style.ts

View check run for this annotation

Codecov / codecov/patch

src/style/style.ts#L593

Added line #L593 was not covered by tests
}

if (!this._loaded) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"SourceSpecification": "https://maplibre.org/maplibre-style-spec/sources/"
}
}
}
}
Loading