简体   繁体   English

Flow WMS未在我的地图openlayers中显示

[英]Flow WMS not displaying in my map openlayers

I want to display a flow WMS in my map openLayers but nothing display. 我想在我的地图openLayers中显示流WMS,但没有任何显示。 Here how i declare my WMS : 我在这里如何声明我的WMS:

var IGN = new ImageLayer({ source: new ImageWMS({ url: 'https://inspire.cadastre.gouv.fr/scpc/76758.wms?service=WMS&request=GetMap', params: {'LAYERS': 'AMORCES_CAD', 'FORMAT': 'image/png'}, ratio: 1, serverType: 'geoportail' }), visible : false, name : 'IGN' });

then when i declare my map in the layers : 然后当我在图层中声明我的地图时:

layers: [baseLayer,Terrain,foncier2,satellite,IGN]

My URL WMS is wrong ? 我的网址WMS错了? Or my statement is wrong ? 或者我的陈述是错的?

Thanks you in advance 提前谢谢你

PS : I work with OpenLayers 5 PS:我与OpenLayers 5合作

EDIT : I solve my problem, it was the wrong server. 编辑:我解决了我的问题,这是错误的服务器。

It it had been the correct server were some problems with your code. 它是正确的服务器是你的代码的一些问题。

The url is longer than necessary, geoportail isn't a server type recognised by OpenLayers and visible : false will stop the layer displaying. url超出必要的时间,geoportail不是OpenLayers识别的服务器类型,并且visible : false将停止显示图层。

var IGN = new ImageLayer({
  source: new ImageWMS({
//    url: 'https://inspire.cadastre.gouv.fr/scpc/76758.wms?service=WMS&request=GetMap',
    url: 'https://inspire.cadastre.gouv.fr/scpc/76758.wms',
    params: {'LAYERS': 'AMORCES_CAD',
    'FORMAT': 'image/png'},
    ratio: 1,
//    serverType: 'geoportail'
  }),
//  visible : false,
  name : 'IGN'
});

But even with those changes I get an error from the server 但即使有这些更改,我也会从服务器收到错误

Mauvaise Requête Taille de l'image invalide. Mauvaise Requête Taille de l'image invalide. Mauvaise Requête Taille de l'image invalide.

With a very small map it does work, but a tile layer works on any size map: 使用非常小的地图确实有效,但是图层可以在任何尺寸的地图上使用:

var IGN = new TileLayer({
  source: new TileWMS({
    url: 'https://inspire.cadastre.gouv.fr/scpc/76758.wms',
    params: {'LAYERS': 'AMORCES_CAD',
    'FORMAT': 'image/png'},
  }),
  name : 'IGN'
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM