mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 02:45:26 +01:00
Remove projection code for now.
This commit is contained in:
parent
884dc6fa49
commit
cb6c6e0d9f
4 changed files with 3 additions and 47 deletions
|
@ -39,7 +39,6 @@
|
|||
"maputnik-design": "github:maputnik/design",
|
||||
"ol": "^6.0.0-beta.8",
|
||||
"ol-mapbox-style": "^5.0.0-beta.2",
|
||||
"proj4": "^2.5.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^16.5.2",
|
||||
"react-aria-menubutton": "^6.0.1",
|
||||
|
|
|
@ -483,11 +483,6 @@ export default class App extends React.Component {
|
|||
return metadata['maputnik:renderer'] || 'mbgljs';
|
||||
}
|
||||
|
||||
getProjectionCode () {
|
||||
const metadata = this.state.mapStyle.metadata || {};
|
||||
return this.state.openlayersDebugOptions.enableProjections ? metadata['maputnik:projection'] : "EPSG:3857";
|
||||
}
|
||||
|
||||
mapRenderer() {
|
||||
const metadata = this.state.mapStyle.metadata || {};
|
||||
|
||||
|
@ -507,7 +502,6 @@ export default class App extends React.Component {
|
|||
if(renderer === 'ol') {
|
||||
mapElement = <OpenLayersMap
|
||||
{...mapProps}
|
||||
projectionCode={this.getProjectionCode()}
|
||||
debugToolbox={this.state.openlayersDebugOptions.debugToolbox}
|
||||
onLayerSelect={this.onLayerSelect}
|
||||
/>
|
||||
|
|
|
@ -9,15 +9,9 @@ import 'ol/ol.css'
|
|||
import {apply} from 'ol-mapbox-style';
|
||||
import {Map, View, Proj, Overlay} from 'ol';
|
||||
|
||||
import proj4 from 'proj4';
|
||||
import {register} from 'ol/proj/proj4';
|
||||
import {get as getProjection, toLonLat} from 'ol/proj';
|
||||
import {toLonLat} from 'ol/proj';
|
||||
import {toStringHDMS} from 'ol/coordinate';
|
||||
|
||||
// Register some projections...
|
||||
proj4.defs('EPSG:3031', '+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs ');
|
||||
register(proj4);
|
||||
|
||||
|
||||
function renderCoords (coords) {
|
||||
if (!coords || coords.length < 2) {
|
||||
|
@ -64,21 +58,7 @@ export default class OpenLayersMap extends React.Component {
|
|||
apply(this.map, newMapStyle);
|
||||
}
|
||||
|
||||
updateProjection () {
|
||||
this.projection = getProjection(this.props.projectionCode || "EPSG:3857");
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.props.projectionCode !== prevProps.projectionCode) {
|
||||
this.updateProjection();
|
||||
this.map.setView(
|
||||
new View({
|
||||
projection: this.projection,
|
||||
zoom: 1,
|
||||
center: [180, -90]
|
||||
})
|
||||
);
|
||||
}
|
||||
if (this.props.mapStyle !== prevProps.mapStyle) {
|
||||
this.updateStyle(this.props.mapStyle);
|
||||
}
|
||||
|
@ -93,20 +73,17 @@ export default class OpenLayersMap extends React.Component {
|
|||
}
|
||||
});
|
||||
|
||||
this.updateProjection();
|
||||
|
||||
const map = new Map({
|
||||
target: this.container,
|
||||
overlays: [this.overlay],
|
||||
view: new View({
|
||||
projection: this.projection,
|
||||
zoom: 1,
|
||||
center: [180, -90],
|
||||
})
|
||||
});
|
||||
|
||||
map.on('pointermove', (evt) => {
|
||||
var coords = toLonLat(evt.coordinate, this.projection);
|
||||
var coords = toLonLat(evt.coordinate);
|
||||
this.setState({
|
||||
cursor: [
|
||||
coords[0].toFixed(2),
|
||||
|
@ -116,7 +93,7 @@ export default class OpenLayersMap extends React.Component {
|
|||
})
|
||||
|
||||
map.on('postrender', (evt) => {
|
||||
const center = toLonLat(map.getView().getCenter(), this.projection);
|
||||
const center = toLonLat(map.getView().getCenter());
|
||||
this.setState({
|
||||
center: [
|
||||
center[0].toFixed(2),
|
||||
|
|
|
@ -110,20 +110,6 @@ class SettingsModal extends React.Component {
|
|||
/>
|
||||
</InputBlock>
|
||||
|
||||
{this.props.openlayersDebugOptions.enableProjections &&
|
||||
<InputBlock label={"Projection (experimental)"} doc={"Projection of the data"}>
|
||||
<SelectInput {...inputProps}
|
||||
data-wd-key="modal-settings.maputnik:projection"
|
||||
options={[
|
||||
['EPSG:3857', '[EPSG:3857] Web Mercator'],
|
||||
['EPSG:3031', '[EPSG:3031] Antarctic Polar Stereographic (experimental)'],
|
||||
]}
|
||||
value={metadata['maputnik:projection'] || 'EPSG:3857'}
|
||||
onChange={this.changeMetadataProperty.bind(this, 'maputnik:projection')}
|
||||
/>
|
||||
</InputBlock>
|
||||
}
|
||||
|
||||
</div>
|
||||
</Modal>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue