[Geoserver-users] wms layer not show up in openlayer

Hi,

Not sure I am allowed to post here regarding OpenLayer loading WMS from geoserver. Please see below code. If I have only OSM and mems layers, then I can see the map. But if I tried to load one of the three red box layers (arcgis, wms and test3) I can not see any map.

Is there anyone know why it did not bring the WMS from Geoserver. Even I tried ArcGIS world topo image but still no luck. I can see wms layer in Geoserver layer view.

Thanks,

Daniel

According to the openlayers docs there is not an ImageLayer nor is there a TileLayer it is Image and Tile

So change

const arcgis = new TileLayer({…

to

const arcgis = new Tile({…

and

const wms = new ImageLayer({…

to

const wms = new Image({…

and see how that goes

image001.png

···

From: Daniel Yu dyu@anonymised.com
Sent: Tuesday, 5 October 2021 1:43 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] wms layer not show up in openlayer

Hi,

Not sure I am allowed to post here regarding OpenLayer loading WMS from geoserver. Please see below code. If I have only OSM and mems layers, then I can see the map. But if I tried to load one of the three red box layers (arcgis, wms and test3) I can not see any map.

Is there anyone know why it did not bring the WMS from Geoserver. Even I tried ArcGIS world topo image but still no luck. I can see wms layer in Geoserver layer view.

Thanks,

Daniel

Thanks for your help. It is still not working.

I looked into development tool in browser and noticed below (red circle). I do not know what is that? Is there any setting I need to do?

If I type below URL then I can get PNG image.

image001.png

···

From: Humphries, Graham Graham.Humphries@anonymised.com
Sent: October 4, 2021 5:57 PM
To: Daniel Yu dyu@anonymised.com; geoserver-users@anonymised.comorge.net
Subject: RE: wms layer not show up in openlayer

CAUTION: This email originated from outside of MEMS. Do not click links or open attachments unless you know the content is safe.

According to the openlayers docs there is not an ImageLayer nor is there a TileLayer it is Image and Tile

So change

const arcgis = new TileLayer({…

to

const arcgis = new Tile({…

and

const wms = new ImageLayer({…

to

const wms = new Image({…

and see how that goes

From: Daniel Yu <dyu@anonymised.com>
Sent: Tuesday, 5 October 2021 1:43 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] wms layer not show up in openlayer

Hi,

Not sure I am allowed to post here regarding OpenLayer loading WMS from geoserver. Please see below code. If I have only OSM and mems layers, then I can see the map. But if I tried to load one of the three red box layers (arcgis, wms and test3) I can not see any map.

Is there anyone know why it did not bring the WMS from Geoserver. Even I tried ArcGIS world topo image but still no luck. I can see wms layer in Geoserver layer view.

Thanks,

Daniel


CONFIDENTIALITY NOTICE AND DISCLAIMER
The information in this transmission may be confidential and/or protected by legal professional privilege, and is intended only for the person or persons to whom it is addressed. If you are not such a person, you are warned that any disclosure, copying or dissemination of the information is unauthorised. If you have received the transmission in error, please immediately contact this office by telephone, fax or email, to inform us of the error and to enable arrangements to be made for the destruction of the transmission, or its return at our cost. No liability is accepted for any unauthorised use of the information contained in this transmission.

The browser is expecting the request to be to http://localhost:8080/… But it looks like you have a url going to http://2014-0301:8080/… Which is causing a CORS issue.

image002.png

image001.png

image005.jpg

···

From: Daniel Yu dyu@anonymised.com
Sent: Tuesday, 5 October 2021 2:42 PM
To: Humphries, Graham Graham.Humphries@anonymised.com; geoserver-users@lists.sourceforge.net
Subject: RE: wms layer not show up in openlayer

Thanks for your help. It is still not working.

I looked into development tool in browser and noticed below (red circle). I do not know what is that? Is there any setting I need to do?

If I type below URL then I can get PNG image.

From: Humphries, Graham <Graham.Humphries@anonymised.com>
Sent: October 4, 2021 5:57 PM
To: Daniel Yu <dyu@anonymised.com>; geoserver-users@lists.sourceforge.net
Subject: RE: wms layer not show up in openlayer

CAUTION: This email originated from outside of MEMS. Do not click links or open attachments unless you know the content is safe.

According to the openlayers docs there is not an ImageLayer nor is there a TileLayer it is Image and Tile

So change

const arcgis = new TileLayer({…

to

const arcgis = new Tile({…

and

const wms = new ImageLayer({…

to

const wms = new Image({…

and see how that goes

From: Daniel Yu <dyu@anonymised.com>
Sent: Tuesday, 5 October 2021 1:43 AM
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] wms layer not show up in openlayer

Hi,

Not sure I am allowed to post here regarding OpenLayer loading WMS from geoserver. Please see below code. If I have only OSM and mems layers, then I can see the map. But if I tried to load one of the three red box layers (arcgis, wms and test3) I can not see any map.

Is there anyone know why it did not bring the WMS from Geoserver. Even I tried ArcGIS world topo image but still no luck. I can see wms layer in Geoserver layer view.

Thanks,

Daniel


CONFIDENTIALITY NOTICE AND DISCLAIMER
The information in this transmission may be confidential and/or protected by legal professional privilege, and is intended only for the person or persons to whom it is addressed. If you are not such a person, you are warned that any disclosure, copying or dissemination of the information is unauthorised. If you have received the transmission in error, please immediately contact this office by telephone, fax or email, to inform us of the error and to enable arrangements to be made for the destruction of the transmission, or its return at our cost. No liability is accepted for any unauthorised use of the information contained in this transmission.