openlayers-6

Openlayers : Prevent features icons overlay

て烟熏妆下的殇ゞ 提交于 2021-02-19 08:27:32
问题 I'm using openlayers (v6.4.3) to display a map with features in different layers. I want to prevent overlay of feature's icons from different layers : if two of them overlap, I have to move one of the icons. I looked on the official openlayer's documentation but I can't find an option or a method to achieve that. Thanks for any help ! 来源: https://stackoverflow.com/questions/64043593/openlayers-prevent-features-icons-overlay

Wrapping Geojson data across date line in Openlayers

白昼怎懂夜的黑 提交于 2021-01-29 19:36:41
问题 I am using OpenLayers to map earthquakes using the USGS dataset available at: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson I am adding layers and configuring the view like so: var map = new Map({ target: 'map', layers: [ new TileLayer({ source: new OSM() }), new ImageLayer({ opacity: 0.3, source: raster }), new WebGLPointsLayer({ source: new VectorSource({ url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", format: new GeoJSON(),

Openlayers 6 - Show Geojson Label on line

China☆狼群 提交于 2021-01-29 14:00:57
问题 I am confused about how to put a label in GeoJSON file to show on the map. I've tried many of examples from openlayers.org but they won't work. I want to show the text from properties "name" in my GeoJSON file on top of the map and along the line, like street name. Now only the line is displayed. Here's my script. <script type="text/javascript"> var style = new ol.style.Style({ text: new ol.style.Text({ font: 'bold 11px "Open Sans", "Arial Unicode MS", "sans-serif"', placement: 'line', fill:

typescript type definitions for Open Layers 6

孤人 提交于 2021-01-28 02:32:09
问题 The @types/openlayers package (https://www.npmjs.com/package/@types/openlayers) only supplies type definitions for OpenLayers 4.6 . This is stated explicitly at the top comment in file index.d.ts . Are types for OpenLayers 6 available and, failing that, what should be the course of action for developing Typescript applications with OpenLayers 6 ? 回答1: Take a look at @types/ol: This package contains type definitions for ol (https://github.com/openlayers/openlayers). Version 6.4.2 回答2: If I

Adding map markers to Open Layers 6

醉酒当歌 提交于 2020-08-11 05:12:15
问题 My question is simple: How do you add a marker at a specific longitude and latitude? Working through the open layers example page I have created a new map with a marker. I added the marker using the new ol.Feature but it seems no matter what I set the coordinates to the marker position will not change . Please can anyone offer advice on why the map marker is not showing in the correct position? const iconFeature = new ol.Feature({ geometry: new ol.geom.Point([53, -2]), //This marker will not

Adding map markers to Open Layers 6

微笑、不失礼 提交于 2020-08-11 05:12:11
问题 My question is simple: How do you add a marker at a specific longitude and latitude? Working through the open layers example page I have created a new map with a marker. I added the marker using the new ol.Feature but it seems no matter what I set the coordinates to the marker position will not change . Please can anyone offer advice on why the map marker is not showing in the correct position? const iconFeature = new ol.Feature({ geometry: new ol.geom.Point([53, -2]), //This marker will not

OpenLayers Map addLayer and getLayers methods dealing with custom layer types

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-10 22:49:55
问题 I am extending LayerGroup and TileLayer classes to include an id property that I need to identify a specific layer/group of layers (this also reflects an id of a layer DIV in the DOM). Example for TileLayer : export class OperationalLayer extends TileLayer { id: String; constructor(url: string, name: string, id: string) { const source = new TileWMS({ params: {'LAYERS': name}, url: url, }); super({source: source}); this.id = id; } } I also have another class which extends the ol Map class.

OpenLayers Map addLayer and getLayers methods dealing with custom layer types

a 夏天 提交于 2020-08-10 22:49:42
问题 I am extending LayerGroup and TileLayer classes to include an id property that I need to identify a specific layer/group of layers (this also reflects an id of a layer DIV in the DOM). Example for TileLayer : export class OperationalLayer extends TileLayer { id: String; constructor(url: string, name: string, id: string) { const source = new TileWMS({ params: {'LAYERS': name}, url: url, }); super({source: source}); this.id = id; } } I also have another class which extends the ol Map class.

OpenLayers Map addLayer and getLayers methods dealing with custom layer types

回眸只為那壹抹淺笑 提交于 2020-08-10 22:48:57
问题 I am extending LayerGroup and TileLayer classes to include an id property that I need to identify a specific layer/group of layers (this also reflects an id of a layer DIV in the DOM). Example for TileLayer : export class OperationalLayer extends TileLayer { id: String; constructor(url: string, name: string, id: string) { const source = new TileWMS({ params: {'LAYERS': name}, url: url, }); super({source: source}); this.id = id; } } I also have another class which extends the ol Map class.