SharpMap: GIS engine review

    Good afternoon, dear habrasociety.
    In my opinion, the topic of working with spatial data, and in particular with GIS systems, is poorly covered on Habré. As a result, I would like to devote my first article to a wonderful tool called SharpMap . Moreover, the object of consideration is quite interesting from the point of view of developing GIS applications, and there is little information in Russian about its use. The search returns only a few results in forums devoted to programming topics.

    Introduction


    The following definition is given on the project’s official website:
    SharpMap is an easy-to-use mapping library for use in desktop and web applications. The engine is written in C # and is based on the .NET 2.0 framework. Distributed under the GNU Lesser General Public License .

    Opportunities


    Currently, two versions of the engine are being developed, differing in their capabilities.
    OpportunitiesSharpMap v1.0SharpMap v2.0
    Using .NET programming languages ​​(C #, VB.NET etc.)++
    Representation of attributes as labels+Beta 2
    Support for points, lines, polygons, multipolygons, multi-points, etc. according to the OpenGIS specification++
    Zooming and moving around the map++
    Extended Themed Maps++
    Change projection "on the fly"++
    Layered spatial indexing-+
    Ability to select and highlight geometries-+
    Spatial analysis and geometry processing-+
    Ability to replace geometries, spatial indexes, and projection libraries-+
    For WEBSharpMap v1.0SharpMap v2.0
    Http Handler for creating images+not finished
    AJAX - control +not finished
    Use as a WMS 1.3.0 server+not finished

    Extensions


    By default, SharpMap only works with the vector format of Shape files, however, due to extensions, the number of supported formats can be increased.
    ExpansionDescription
    OGR PoviderA library that adds support for many vector data formats
    GDAL Raster LayerAdding support for multiple raster formats
    PostgisPostgreSQL / PostGIS Provider
    OracleOracle Spatial Information Provider
    NetTopologySuite Data ProviderAdds NTS functionality
    Simple chartAdds attribute-based charts to the map
    Spatialline SQLite / SpatialLite Provider

    The GDAL / OGR library , which has also not yet been covered on Habré, deserves a separate review and a separate article.


    In action


    At first glance, the implementation of the application using SharpMap and, in particular, the inclusion of the GDAL / OGR library did not seem quite obvious. I had to look through a lot of English-language forums to figure out what's what.
    An example will be given for SharpMap v.1.0 in the Visual Studio 2008 development environment.
    So, for starters, download the ChangeSet project. At the time of writing, version No. 74794 is relevant.
    Unpack.

    To demonstrate the capabilities of the engine, it is proposed to run the SharpMap.VS2008.sln project file in the Trunk folder. In SolutionExplorer install the WinFormSamples project as StartUp Project.

    image

    The right pane of the form shows the RadioButton set with the corresponding file types. All test geo-data files are stored in the directory:Trunk \ WinFormSamples \ bin \ Debug \ GeoData .
    By default, the Shapefile opens in the right pane with the map .
    Similarly, view the item Gradiet Theme.

    image

    When trying to output files in the format “MapInfo” (vector) and “GeoTiff” (raster), an error occurs because the corresponding GDAL / OGR libraries are not connected . To connect them, you need to download the set of FWTools libraries and install.
    Then in the Trunk \ WinFormSamples directory, open the file “app.config” and in the appSettings block we change all the paths to the path to the FWTools folder and its subdirectories (if required).
    Recompile the Build -> Rebuild Solution project. We start.
    After the done manipulations, it becomes possible to open many vector and raster formats and work with them.

    image

    image

    On this I want to end. More information about SharpMap, as well as documentation and a forum on the project website:
    SharpMap v1.0
    SharpMap v2.0
    Thank you for your attention!

    Also popular now: