openlayers-3

Convert xyz coordinate of a tile to longitude/latitude

≡放荡痞女 提交于 2021-02-19 03:20:36
问题 I wanted to make a map using openlayers but center it a unique way. For example I have a z/x/y coordinate of 12/2045/-1362, how do I convert it to longitude/latitude? It's quite the polar opposite of this: How to get X Y Z coordinates of tile by click on Leaflet map It's quite hard for me to get the logic of the above link and invert it. I hope someone here has an experience or a ready-made formula for this. Thanks Later I'll this in rendering the center of my map like this: var z = 12; var x

Can I drag the map with ctrl in Openlayers3?

╄→尐↘猪︶ㄣ 提交于 2021-02-10 05:59:25
问题 Exist a way to drag the map when I hold down the Ctrl (control) key? Normally to drag the map is necessary just hold the left mouse button and move on the map, but I need to drag the map without hold the left mouse button but with the ctrl button. Is possibile? 回答1: There is indeed a way to only allow panning while holding ctrl-key. A fully working example can be found in this fiddle: https://jsfiddle.net/mnpq3ufe/ For it to work, you have to disable the existing dragPan interaction in your

Open layers 3, map.on('moveend',..): Differentiate between user interaction and map.setCenter() calling

China☆狼群 提交于 2021-02-10 05:13:34
问题 I am implementing OL for a GIS application and want to add a 20 seconds timeout when the user scrolled the map, after which the GPS auto track function should resume. For that I am utilizing the map.on('moveend', move_func(..)) listener. The problem is that it cannot differenciate whether the user scrolled or the position change came from map.setCenter(..). Although I could implement a state variable which is set to true every time map.setCenter() is called, this does not only seem un-elegant

Open layers 3, map.on('moveend',..): Differentiate between user interaction and map.setCenter() calling

巧了我就是萌 提交于 2021-02-10 05:05:07
问题 I am implementing OL for a GIS application and want to add a 20 seconds timeout when the user scrolled the map, after which the GPS auto track function should resume. For that I am utilizing the map.on('moveend', move_func(..)) listener. The problem is that it cannot differenciate whether the user scrolled or the position change came from map.setCenter(..). Although I could implement a state variable which is set to true every time map.setCenter() is called, this does not only seem un-elegant

Module not found: Error: Can't resolve 'openlayers' using TypeScript definition file

喜欢而已 提交于 2021-02-08 15:11:00
问题 In a Visual Studio 2017 React application using TypeScrpt there is a component (Map.tsx) that utilizes OpenLayers v4.6.5. The package.json file loads both the @types/openlayers and the "ol" module. { "name": "mhc-maps", "private": true, "version": "2.0.0", "devDependencies": { "@types/history": "^4.6.2", "@types/jquery": "^3.3.1", "@types/openlayers": "^4.6.9", "@types/react": "^16.3.5", "@types/react-dom": "^16.0.4", "@types/react-hot-loader": "^3.0.6", "@types/react-router": "^4.0.23", "

Module not found: Error: Can't resolve 'openlayers' using TypeScript definition file

爷,独闯天下 提交于 2021-02-08 15:10:33
问题 In a Visual Studio 2017 React application using TypeScrpt there is a component (Map.tsx) that utilizes OpenLayers v4.6.5. The package.json file loads both the @types/openlayers and the "ol" module. { "name": "mhc-maps", "private": true, "version": "2.0.0", "devDependencies": { "@types/history": "^4.6.2", "@types/jquery": "^3.3.1", "@types/openlayers": "^4.6.9", "@types/react": "^16.3.5", "@types/react-dom": "^16.0.4", "@types/react-hot-loader": "^3.0.6", "@types/react-router": "^4.0.23", "

Module not found: Error: Can't resolve 'openlayers' using TypeScript definition file

柔情痞子 提交于 2021-02-08 15:10:12
问题 In a Visual Studio 2017 React application using TypeScrpt there is a component (Map.tsx) that utilizes OpenLayers v4.6.5. The package.json file loads both the @types/openlayers and the "ol" module. { "name": "mhc-maps", "private": true, "version": "2.0.0", "devDependencies": { "@types/history": "^4.6.2", "@types/jquery": "^3.3.1", "@types/openlayers": "^4.6.9", "@types/react": "^16.3.5", "@types/react-dom": "^16.0.4", "@types/react-hot-loader": "^3.0.6", "@types/react-router": "^4.0.23", "

Drawing an OpenLayers 3 map in a hidden element

♀尐吖头ヾ 提交于 2021-02-08 13:13:11
问题 I am writing a page where you can view both details about an area and a map. The details are on one tab and the map on another. The relevant portion of the HTML is below and the classes are from Bootstrap. <div class="col-xs-8"> <ul class="nav nav-tabs"> <li class="active"><a href="#tab-details" data-toggle="tab">Details</a></li> <li><a href="#tab-map" data-toggle="tab">Map</a></li> </ul> <div class="tab-content"> <div id="tab-details" class="tab-pane fade in active"></div> <div id="tab-map"

Drawing an OpenLayers 3 map in a hidden element

泄露秘密 提交于 2021-02-08 13:09:14
问题 I am writing a page where you can view both details about an area and a map. The details are on one tab and the map on another. The relevant portion of the HTML is below and the classes are from Bootstrap. <div class="col-xs-8"> <ul class="nav nav-tabs"> <li class="active"><a href="#tab-details" data-toggle="tab">Details</a></li> <li><a href="#tab-map" data-toggle="tab">Map</a></li> </ul> <div class="tab-content"> <div id="tab-details" class="tab-pane fade in active"></div> <div id="tab-map"

openlayers3 undefined is not a constructor error on ol.source.StaticVector

南楼画角 提交于 2021-02-08 11:22:20
问题 I am learning openlayers3 with ol v3.20.1 I've got to the point in the book, where I can read/write GeoJSON with StaticVector, but the following code: var statVec = new ol.layer.Vector({ source: new ol.source.StaticVector({ format: new ol.format.GeoJSON(), projection: 'EPSG:3857' }) }); errors out with: TypeError: undefined is not a constructor (evaluating 'new ol.source.StaticVector({ format: new ol.format.GeoJSON(), projection: 'EPSG:3857' })') global code I realize, there was an API change