openlayers 相关问题

OpenLayers是一个开源的Javascript Web映射库,用于创建Web地图应用程序。

如何将地图的顶部固定到包含的 div 的顶部?

如果我向下滚动,地图的顶部会出现在包含 div 的边缘下方,并且会出现蓝色背景。 如果我向上滚动,也会发生同样的事情。地图底部出现在编辑上方...

回答 1 投票 0

如何保证完全缩小后能看到整个世界?

如果我完全缩小,我仍然可能需要上下左右滚动地图才能看到所有内容。我希望能够定义,当完全缩小时,整个世界都可以...

回答 1 投票 0

如何将Openlayers从v4.3.2-214-gb920b78版本更新到最新版本?

我尝试在自定义应用程序上更新 Open Layer 7.4.0 版本,但 openlayers 停止工作。 我从网站下载了最新的openlayer版本:https://openlayers.org/download/ 还有...

回答 1 投票 0

更改 Angular 16+ 中 openlayer 地图中样式图标的不透明度

我需要更改添加到openlayers地图的功能中的样式图标(使用最新的openlayers版本)。我仅使用单层,因此无法在图层中应用不透明度。我有多个

回答 1 投票 0

使用 OpenLayers 开发 Web 地图解决方案时模拟移动地理位置

标题很长,但问题很简单,我真的还没有找到好的解决方案。 先决条件 ASP.NET Framework Web 表单应用程序(不是很重要) 使用 OpenLayers 2.14 的地图解决方案(是的...

回答 1 投票 0

使用H3和OpenLayers在墨卡托投影中生成六角形贴图,在-+180度处有一个间隙

我将在这里放置部分代码,这对于理解问题很重要。 const createHex = (lat: 任意, lng: 任意) => { const cell = latLngToCell(lng, lat, 1); 常量坐标...

回答 1 投票 0

如何将 OpenLayers 与 Elm.Land 集成

我使用 ElmLand 的 Web 组件示例作为为 OpenLayers 构建 Web 组件的指南,并使用该站点的介绍创建了一个项目。 该应用程序在本地主机中运行,带有静默控制台

回答 1 投票 0

OpenLayers - LayerSwitcher 更改可见性

我正在开发一个基于 Angular 的应用程序,它使用 OpenLayers 在地图上显示给定的数据。 对于这张地图,我使用了 LayerSwitcher (ol-ext.control.LayerSwitcher): 常量层切换器 = 新

回答 1 投票 0

OpenLayers:删除特定缩放级别上的簇(即使对于相同的坐标)

我正在使用 OpenLayers 7,我有一个数据集,其中包含许多我需要在地图上标记的 geojson 功能。为了获得不错的性能,我需要在缩小时将它们聚集起来。这个世界...

回答 1 投票 0

OpenLayers:地图中每个 GeoJson 功能都有自己的颜色?

有任何关于要素样式类型等的示例,但这只是针对简单地图的一个想法,而不是针对与数据库中不断变化的信息相结合的大量数据。 这是我的

回答 1 投票 0

图层组未显示在我的 Web 应用程序中。仅显示一层并且单击事件不起作用

我已成功在 GeoServer 中将三个 shapefile 作为图层组发布。但是,在我的 Web 应用程序中,我目前面临一个问题,即图层组中仅显示一个图层,...

回答 0 投票 0

如何从 GeoJSON 属性在 OpenLayers 中添加线串

我有一个带有简单 GeoJSON 文件层(几个城镇)的地图,每个城镇都有一个“bbox”属性。它是一个点或一条线串。 GeoJSON 文件如下所示: {“类型”:“

回答 0 投票 0

使用开放图层图时如何指定形状的显示顺序

我创建了一张由不同形状(例如 2 个圆圈和一条线)组成的地图。该线连接 2 个圆的中心。即使我先添加了线条,然后添加了圆圈,线条总是出现...

回答 0 投票 0

如果我使用硬编码 id,Openlayers 就会开始加载,但如果我使用 [id],则不会加载

我的组件: 公社选择: 我的组件: <div> <label>Sélectionnez une commune :&nbsp;</label> <app-communes anneeCOG="2023"></app-communes> </div> <div *ngFor="let region of regions;"> <app-carte [id] = "environment[region + '_id']" [nom]="environment[region + '_nom']" [url_couche] = "environment[region + '_couche_url']" [layer_couche] = "environment[region + '_couche_layer']" [longitude] = "environment[region + '_longitude_initale']" [latitude] = "environment[region + '_latitude_initale']" [zoom] = "environment[region + '_zoom']" [projection] = "environment[region + '_projection']"> </app-carte> </div> 依赖于environment.ts文件: // Métropole metropole_id: 'carte_metropole', // Identifiant de la carte (placé dans la balise) metropole_nom: 'Métropole', // Nom de cette partie de carte metropole_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', // Plan IGN V2 metropole_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', // Plan IGN V2, tuilé metropole_projection: 'EPSG:3857', // Web Mercator projection metropole_latitude_initale: 46.53333333, // Centroïde de la France, d'après IGN en 1993 (Commune de Vesdun dans le Cher) metropole_longitude_initale: 2.41666667, metropole_zoom: 6, // Guadeloupe guadeloupe_id: 'carte_guadeloupe', guadeloupe_nom: 'Guadeloupe', guadeloupe_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', guadeloupe_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', guadeloupe_projection: 'EPSG:3857', guadeloupe_latitude_initale: 16.265, guadeloupe_longitude_initale: -61.551, guadeloupe_zoom: 9, // Martinique martinique_id: 'carte_martinique', martinique_nom: 'Martinique', martinique_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', martinique_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', martinique_projection: 'EPSG:3857', martinique_latitude_initale: 14.641528, martinique_longitude_initale: -61.024174, martinique_zoom: 9, // Guyane guyane_id: 'carte_guyane', guyane_nom: 'Guyane', guyane_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', guyane_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', guyane_projection: 'EPSG:3857', guyane_latitude_initale: 3.933889, guyane_longitude_initale: -53.125782, guyane_zoom: 8, // La Réunion la_reunion_id: 'carte_la_reunion', la_reunion_nom: 'La Réunion', la_reunion_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', la_reunion_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', la_reunion_projection: 'EPSG:3857', la_reunion_latitude_initale: -21.115141, la_reunion_longitude_initale: 55.536384, la_reunion_zoom: 9, // Mayotte mayotte_id: 'carte_mayotte', mayotte_nom: 'Mayotte', mayotte_couche_layer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', mayotte_couche_url: 'https://wxs.ign.fr/decouverte/geoportail/wmts', mayotte_projection: 'EPSG:3857', mayotte_latitude_initale: -12.827500, mayotte_longitude_initale: 45.166244, mayotte_zoom: 9 并由以下人员实施: export class CarteFranceComponent { protected readonly environment= environment; protected regions: string[] = ['metropole', 'guadeloupe', 'martinique', 'guyane', 'la_reunion', 'mayotte'] } 它使用 app-carte 标签,其 html 仅限于: <div class="{{id}}" id="{{id}}"></div> 它的实现就是这样开始的,因为它的初始加载部分给我带来了麻烦: export class CarteComponent implements OnInit { /** Identifiant de la carte (placé dans sa balise) */ @Input() id!: string; /* Nom de cette carte */ @Input() nom!: string; /* Longitude. */ @Input() longitude!: number; /* Latitude. */ @Input() latitude!: number; /** Niveau de zoom initial. */ @Input() zoom!: number; /** Projection */ @Input() projection!: string; /** URL de la couche à afficher initialement. */ @Input() url_couche!: string; /** Layer de la couche à afficher initialement. */ @Input() layer_couche!: string; /** Couche géographique à afficher */ private couche_geographique: TileLayer<WMTS>; /** Map Openlayer */ private coucheOpenLayer: Map; /** * Initialiser le composant carte */ ngOnInit(): void { // Déclarer la couche, si elle n'est pas encore connue if (this.couche_geographique == null) { console.log(`Chargement initial de la carte '${this.nom}' avec la couche géographique '${this.layer_couche}' depuis l'URL ${this.url_couche}. Id de destination: '${this.id}'`) this.couche_geographique = this.declare_couche(this.url_couche, this.layer_couche, this.projection, 'image/png'); } // Placer la couche demandée, aux coordonnées et zoom initiaux demandées console.log(`Initialisation de la carte '${this.nom}' (id: '${this.id}')`) this.coucheOpenLayer = new Map({ layers: [ this.couche_geographique ], target: this.id, view: new View({ center: fromLonLat([this.longitude, this.latitude]), zoom: this.zoom, projection: this.projection }) }); this.coucheOpenLayer.on('loadstart', function() { console.log(`Début du chargement de la carte`) }) this.coucheOpenLayer.on('loadend', function() { console.log(`Fin du chargement de la carte`) }) this.coucheOpenLayer.on('error', function() { console.log(`Erreur de chargement de la carte`) }) } [...] 运行时,控制台显示: Démarrage environnement dev spark: http://localhost:9090 backend: http://localhost:9091 app.component.ts:14:12 Chargement initial de la carte 'Métropole' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_metropole' carte.component.ts:58:14 Initialisation de la carte 'Métropole' (id: 'carte_metropole') carte.component.ts:63:12 Chargement initial de la carte 'Guadeloupe' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_guadeloupe' carte.component.ts:58:14 Initialisation de la carte 'Guadeloupe' (id: 'carte_guadeloupe') carte.component.ts:63:12 Chargement initial de la carte 'Martinique' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_martinique' carte.component.ts:58:14 Initialisation de la carte 'Martinique' (id: 'carte_martinique') carte.component.ts:63:12 Chargement initial de la carte 'Guyane' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_guyane' carte.component.ts:58:14 Initialisation de la carte 'Guyane' (id: 'carte_guyane') carte.component.ts:63:12 Chargement initial de la carte 'La Réunion' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_la_reunion' carte.component.ts:58:14 Initialisation de la carte 'La Réunion' (id: 'carte_la_reunion') carte.component.ts:63:12 Chargement initial de la carte 'Mayotte' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_mayotte' carte.component.ts:58:14 Initialisation de la carte 'Mayotte' (id: 'carte_mayotte') 区域循环点处的断点(即:在“Martinique”上,id:“carte_martinique”)显示正确的值: 进行 HTML 检查,我发现: 根本没有 openlayers 加载。 但是,如果我在 this.id = 'carte_martinique' 中强加 ngOnInit(): ngOnInit(): void { // Déclarer la couche, si elle n'est pas encore connue if (this.couche_geographique == null) { console.log(`Chargement initial de la carte '${this.nom}' avec la couche géographique '${this.layer_couche}' depuis l'URL ${this.url_couche}. Id de destination: '${this.id}'`) this.couche_geographique = this.declare_couche(this.url_couche, this.layer_couche, this.projection, 'image/png'); } this.id = "carte_martinique"; // Placer la couche demandée, aux coordonnées et zoom initiaux demandées console.log(`Initialisation de la carte '${this.nom}' (id: '${this.id}')`) this.coucheOpenLayer = new Map({ layers: [ this.couche_geographique ], target: this.id, view: new View({ center: fromLonLat([this.longitude, this.latitude]), zoom: this.zoom, projection: this.projection }) }); openlayers 加载正在开始。 Chargement initial de la carte 'Métropole' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_metropole' carte.component.ts:58:14 Initialisation de la carte 'Métropole' (id: 'carte_martinique') carte.component.ts:65:12 Chargement initial de la carte 'Guadeloupe' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_guadeloupe' carte.component.ts:58:14 Initialisation de la carte 'Guadeloupe' (id: 'carte_martinique') carte.component.ts:65:12 Chargement initial de la carte 'Martinique' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_martinique' carte.component.ts:58:14 Initialisation de la carte 'Martinique' (id: 'carte_martinique') carte.component.ts:65:12 Chargement initial de la carte 'Guyane' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_guyane' carte.component.ts:58:14 Initialisation de la carte 'Guyane' (id: 'carte_martinique') carte.component.ts:65:12 Chargement initial de la carte 'La Réunion' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_la_reunion' carte.component.ts:58:14 Initialisation de la carte 'La Réunion' (id: 'carte_martinique') carte.component.ts:65:12 Chargement initial de la carte 'Mayotte' avec la couche géographique 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2' depuis l'URL https://wxs.ign.fr/decouverte/geoportail/wmts. Id de destination: 'carte_mayotte' carte.component.ts:58:14 Initialisation de la carte 'Mayotte' (id: 'carte_martinique') carte.component.ts:65:12 Angular is running in development mode. Call enableProdMode() to enable production mode. core.mjs:25520:16 Début du chargement de la carte Fin du chargement de la carte 我可以看到 ol-viewport div 聚集在第一个 div 下,并且有 id carte_martinique(他们现在都有): 为什么,当我在循环内使用 this.id 时,openlayers 不会考虑 id carte_martinique, 但如果我硬编码它,它会吗?

回答 0 投票 0

map.foreachfeatureatpixel() 在角度打字稿开放层 7 中不起作用

代码在正常的Javascript中运行良好,但在typescript(角度)中它抛出一个错误,this.map.foreachfeatuatpixel(),this.map未定义,无法读取未定义的属性 T...

回答 0 投票 0

useState 布尔值

在useEffect内部,useState布尔值不会改变。请帮我。 我试图在 openlayers 地图中单击标记时弹出一个模式窗口。由于 openlayers 地图是 ex...

回答 2 投票 0

Openlayers - 选择交互 - 不要使用 ol.style.Icon 和 ol.style.FontSymbol 查询点几何

我试图在选择具有 ol.style.Style 样式的点几何时不查询,其中在某些情况下配置 ol.style.Icon,在其他情况下配置 ol.style.FontSymbol ol.style.Icon 前...

回答 0 投票 0

OpenLayers:无法渲染几乎相同的两个 tiff 文件

我创建了这个 codesandbox 示例,在其中我没有任何样式地渲染了一个 tiff: https://codesandbox.io/s/cog-test-aspect-kriw38?file=/main.js tiff 来源是这个 https://andy-aws.s3.eu-no...

回答 0 投票 0

如何使用 OpenLayers 和 GeoServer 生成动态图例?

我正在使用 OpenLayers 3 和 GeoServer 创建具有多个图层的地图。我能够使用 GetLegendGraphic 从 GeoServer 为每一层生成图例,并使用以下内容显示它们: &...

回答 0 投票 0

在 Openlayers 中如何从 WMTS 渲染多波段 geotiff 磁贴?

我使用带有 ol.source.WMTS 的 Openlayers 加载了多波段 geotiff, 我想用一些乐队的价值来呈现定制的风格。 我知道我可以使用 geotiff.js 和 canvas 来实现,但是......

回答 0 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.