AddLayer strange behaviour

Dim intLayerHandle As Integer = AxMap1.AddLayer(objWmsLayer, True)
please explain me in that cases intLayerHandle is -1 (error)
I tried with a typo in baseurl but the result is always greater than -1
so i can’t understand if it’s really an error

Hello @MAX

Are you saying that you always get a Handle greater than -1, but there is still an error?

It’s possible, perhaps, with the WMS layer, that the layer object might be added successfully, returning a valid layer handle, but that there is still something wrong internally with the WMS layer itself, which might cause it not to display (including an invalid URL).

Regards,
Jerry.

Just as a follow-up, you can look at the Global or WMS-specific error after trying to load the layer. Something like:

objWmsLayer.ErrorMsg(objWmsLayer.LastErrorCode)

I try now
thanks @jerryfaust

…yes, map control don’t display the wms
can you help me? can you try to solve for me?
here il an example:
https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?service=WMS&request=GetMap&layers=CP.CadastralParcel&styles=&format=image%2Fpng&transparent=true&version=1.1.1&width=256&height=256&srs=EPSG%3A6706&bbox=10.350494384765627,44.788657917188125,10.351867675781252,44.78963254761407
and getcapabilities:
https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

It says “No Error” (I tried with typo error in baseurl, wrong bbox, wrong epsg, wrong version… same message)

this is MW5 with wms:


I see inverted coordinates plus a bad visualization :slight_smile:
by the way…
this is extracted from 1.1.1 getcapabilities:

LatLonBoundingBox minx=“2” miny=“33” maxx=“19” maxy=“48”
BoundingBox SRS=“EPSG:6706” minx=“2” miny=“33” maxx=“19” maxy=“48”

and this from 1.3.0:

EX_GeographicBoundingBox
westBoundLongitude 2 westBoundLongitude
eastBoundLongitude 19 eastBoundLongitude
southBoundLatitude 33 southBoundLatitude
northBoundLatitude 48 northBoundLatitude
/EX_GeographicBoundingBox
BoundingBox CRS=“EPSG:6706” minx=“33” miny=“2” maxx=“48” maxy=“19”