Rendering, Themeing, and Querying Data from a Custom File Format

Topics: Data Access
Jun 5, 2012 at 10:05 PM

Here is the scenario I am trying to implement. I am working with a custom file format that contains geospatial data. The data is a list of "blocks", each block consisting of a set of ECEF points in addition to other point assets. Essentially, a list of LineStrings and Points.

I want to create a layer that consists. I have test code that manually converts the point to SpericalMercator and adds LineString collections of the points to a GeometryFeatureCollection and use that as a VectorLayer. Doing this I am able to plot the blocks and asset points over a OSM tile layer.

How would I "tag" the Polylines in order to use the CustomTheme delegate to highlight certain blocks. Basically, I could provide a list of block ids to highlight and the delegate would specify those blocks to have a different color. If I set a UserData object for each block LineString could I access that in the FeatureDataRow object in the CustomTheme delegate? (

How can I have support for selecting features by clicking. The How To.. example isn't working for me. I would want to "tag" or "label" the Geometries with the identifier user in the custom file, then be able to click on the geometry and be able to retrieve the identifier of what I click. (

Would it be better to implementing a IProvider for my custom file format then using the GeometryFeatureCollection? Essentially, is there a better way to add all this data to the map.

Jun 6, 2012 at 6:13 AM

That depends on the size of your data:

  • If you have many features with lots of properties implement IProvider.
  • If it is reasonably small, setup a FeatureDataTable, read your data into it and use it with a GeometryFeatureProvider

Hth FObermaier

Jun 6, 2012 at 5:45 PM

Thanks for the advice, I figured out how to use the FeatureDataTable to set the metadata that I could use to highlight the blocks and other features.

How small is reasonably small? I would estimate for a large file, there would be about 750 Linestrings each containing between 3 - 150 points (I would estimate most skew to the low). So probably about 7000-8000 points for the high end. Would implementing IProvider even matter, since the data comes from a file and not a database I probably wouldn't be able to optimize memory use (I'm assuming that's the point).

I'm still not sure how to implement clicking on a feature. I tried the example code and get nothing in the results.

Jun 6, 2012 at 6:00 PM

Do yourself a favor and use MapBox control from SharpMap.UI project. That way you can use MapTool.Query and only need to handle MapQueried event.

Hth FObermaier