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).


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


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:,44.788657917188125,10.351867675781252,44.78963254761407
and 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:

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