0

I am trying to get the map from WMS which is hosted on GeoServer to the map. I am getting the layer of WMS but I am not able to display in the Map Screen. Here is my code to do so:

ICapabilities capablities = MapInfo.Wms.WmsClientUtilities.GetCapabilities("http://127.0.0.1:8080/geoserver/Jonathan/wms?", "1.1.1");
 MapInfo.Wms.WmsClient wmsClient = new MapInfo.Wms.WmsClient(capablities);
int chartCount = wmsClient.Capabilities.RootLayer.Layers.Count();
wmsClient.AddLayer(wmsClient.Capabilities.RootLayer.Layers[4].Title);
wmsClient.Srs = wmsClient.Capabilities.RootLayer.Layers[4].Bounds[0].Srs;
wmsClient.MimeType = wmsClient.MimeType;
wmsClient.BGColor = Color.White;

MapInfo.Data.TableInfoWms wmsTableInfo = new MapInfo.Data.TableInfoWms("MywmsTable", wmsClient);
Table wmsTable = Session.Current.Catalog.OpenTable(wmsTableInfo);
FeatureLayer featLyr = new FeatureLayer(wmsTable);
MapInfo.Mapping.Map map = MapInfo.Engine.Session.Current.MapFactory.CreateFromFile(@"C:\Program Files (x86)\MapInfo\Data\Introductory Data\World\WORLD.TAB", System.IntPtr.Zero, System.Drawing.Size.Empty);  

map.Layers.Add(featLyr);

What I am doing wrong?

  • is there any error message? can you look on the server and see the GeoServer log? if so what (if any) error messages are there? – Ian Turton Oct 16 at 8:52
  • No there is no error from geoserver side. i am thinking I am doing something wrong while add layer in Mapinfo – Piyush Oct 16 at 9:31
  • See onegeology-docs.readthedocs.io/en/latest/… for details on adding WMS to MapInfo – nmtoken Nov 2 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.