Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
ol3-projection-switcher
Advanced tools
An OpenLayers 3 Control to switch between projections.
npm install ol3-projection-switcher
Create a Projection Switcher control and add it to the map.
var config = {
projections: {
'EPSG:4326': {
layerId: 'arctic',
proj4def: '+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs',
extent: [-4194304, -4194304, 4194304, 4194304],
maxResolution: 8192.0
}
}
}
var projectionSwitcher = new ol.control.ProjectionSwitcher(config);
map.addControl(projectionSwitcher);
The Projection Switcher configuration contains an object with a 'projections' property. Projections are configured with an EPSG code. Each projection is configured using the following properties.
layerId
(Required) Unique identifier for this projectionname
(Optional) Hover text used for the projection buttonlabel
(Optional) Text used for the projection buttonvisible
(Required) Set the default layer visibilityproj4def
(Required) Proj4 Definition from http://epsg.io/extent
(Required) Extent of the layermaxResolution
(Required) Max Resolution of the layerzoom
(Required) Initial zoom levelmaxZoom
(Required) Maximum zoom levelExamples are found in the examples directory. Run them with Webpack from the project root directory.
First run npm install
.
This module uses peer dependencies that are not explicitly installed.
npm install openlayers proj4
Basic Example:
npm run examples:basic
Hemisphere Example:
npm run examples:hemispheres
Start a dev server to run Mocha tests in a browser:
npm run test
The tests can be run at http://localhost:3001/test/
To run linting on the project use npm run lint
To distribute the module:
npm run dist
to build and npm run dist-dev
to build a minified version.
The release process follows SemVer.
Update the version number with <update_type> being a choice of patch, minor, major:
npm version <update_type>
Publish the module:
npm publish
The OpenLayers 3 Projection Switcher is licensed under the MIT license. See LICENSE.txt.
FAQs
OpenLayers 3 controls to change projections.
We found that ol3-projection-switcher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.