I need to be able to access various mapinfo layers but without using the mapinfo api.

I have found that I can convert the mapinfo layers to an access database to get the attribution and I can use sharpMap to load and view the layer.

The problem is now I'm not sure how to get a location shown in sharpmap and then query the objects to get to the attributes, or if its even possible.

It seems that mapinfo might keep this kind of link internaly perhaps

  • What kind of metadata? You mean the attribute information? – Nathan W May 25 '11 at 6:16
  • yes thats correct – Daniel Powell May 26 '11 at 0:48

I looked at SharpMap and it suggests you need a 3rd party to view MapInfo files.

if you want to use MapInfo tab format files, you need an OgrProvider. For SharpMap v0.9 it is in the SharpMap.Extensions project. For SharpMap v2.0 there is one in the branches/initialgdalintegration branch.

If you get this extension, you'll be able to view MapInfo files; Geography and attribution


from the SharpMap web site

I've added the patch with the GetFeatureInfo request possibility.

I've made the following changes.

ICanQueryLayer .cs: Added a boolean in ICanQueryLayer to set layers queryable for the WMS

VectorLayer.cs, GdalRasterLayer.cs, Layergroup.cs: implemented this boolean of ICanQueryLayer

WmsServer.cs: added the getFeatureInfo thing

capabilities.cs: added the required getfeature information for the capabilities

The code added to wmsserver works as follows:

A getfeatureinfo request is received

Checks on all necessary parameters

The map size and boundingbox are set according to the settings of the client and the point clicked in the map of the client is translated to the coordinates of the projection using this new map size and bbox

The optional parameter FEATURES_COUNT is checked whether the client requests one or more features per layer

For each requested layer, it is checked whether the layer is queryable. When true, the layer is queried and all found features are placed in the featuredataset.

This featuredataset is then sorted on area size, because when the client requests a limited number of features, the user is more likely to be interested in the feature with the smallest bbox (imagine a very curved polygon like the character C and a small polygon within the bbox of the 'C' polygon. If the user clicks the small polygon, both the 'C' polygon bbox and the small polygon bbox will be returned. When the FEATURES_COUNT is set to 1, only the feature attributes of the 'C' polygon might be send back, instead of the small polygon attributes the user wanted to see. By sorting on bboxarea from small to large, the small polygon attribute information will be send back. If the user wants to see attribute information of the 'C' polygon, he will click the 'C' polygon and the click will only be within the 'C' polygon bbox and not within the small polygon bbox (hope this is clear to you;-))

Then for each feature that will be returned to the user (as set by FEATURES_COUNT) all the ItemArrays from the featuredataset are placed in the string.

I've added exceptions where necessary. I should have added an exception for quering layers which are set WMSQueryable= false, but I forgot ;-)

A difference between the WMS1.1.1 spec and the WMS 1.3.0 spec is the parameter name of the point clicked by the user. It used to be X and Y in 1.1.1, but this has changed to I and J in 1.3.0. In order to make life a little bit easy for myself in OpenLayers and for others which might not know about this change, I added support for X and Y as well. If both are within the Request, the I and J will overwrite values set by X and Y. Including neither X&Y nor I&J will result in an exception.

These are the major changes.

| improve this answer | |
  • I was able to view the geography data but could not see how to view the attribution data, any ideas? – Daniel Powell May 25 '11 at 7:12
  • I don't know the application, but is that an information button/interface? You should be able to click a point/polygon/line and return its attributes – Hairy May 25 '11 at 7:14
  • from what I can see, there is GetFeatureInfo functionality, via WMS, which should allow you to return text information about an object – Hairy May 25 '11 at 7:16
  • Thanks Hairy, where did you find this information on the sharpmap site? Will try it today – Daniel Powell May 25 '11 at 23:35
  • I've run into some problems on querying the data and posted to the sharpmap site (sharpmap.codeplex.com/discussions/259026) if anyone could help that would be great or should I create a follow up question here? – Daniel Powell May 26 '11 at 0:39

I would not be surprised at your findings/experience.

Any company who creates a proprietary format will always keep the links hidden, else people like us (no pun intended!) will always reverse engineer it.

The same is the case with Geodatabase from ESRI...though you can access the SDE schema and relate a few of the links/logic, you can never wholly de-crypt the way ArcSDE works with these tables/schema.


| improve this answer | |
  • I'd disagree here; MapInfo Pro files are easy to convert into MID/MIF and they are very easy to view. ESRI, however, I would have to agree with you. – Hairy May 25 '11 at 6:59
  • Shouldn't this also be a comment and not an answer? – Hairy May 25 '11 at 7:08
  • Could have been a comment if someone had already posted such an answer (like you replied to my answer). – ujjwalesri May 25 '11 at 9:32
  • MID/MIF are MapInfo files only. So it's very natural to have interoperability among them. What Daniel is probably asking, that without using any third party or native tools/packages, is it possible to extract information out of proprietary formats...the answer to which is plain simple NO. – ujjwalesri May 25 '11 at 9:36
  • he isn't asking that at all. I mentioned MID/MIF, as they are far easier to interpret, than MapInfo propriety format. Is it possible to extract information out of MID/MIF? ABSOLUTELY, 100%! It's simple txt which you can write a parser for. I know this as I have done it. – Hairy May 25 '11 at 10:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.