📜 ⬆️ ⬇️

SharpMap: GIS Engine Overview

Good afternoon, dear habrasoobschestvu.
In my opinion, the topic of working with spatial data and in particular with GIS systems is poorly covered in Habré. As a result, I would like to dedicate 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 yields only single results on the programming forums.


The official project website provides the following definition:
SharpMap is an easy-to-use map 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 .


Currently, the development of two versions of the engine, 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++
Scaling and moving around the map++
Extended Thematic Cards++
Change projection on the fly++
Layer 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


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

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

In action

Implementing an application using SharpMap and, in particular, connecting the GDAL / OGR library at first glance seemed to me not entirely obvious. I had to look through a lot of English-language forums to figure out what was happening.
An example will be given for SharpMap v.1.0 in the Visual Studio 2008 development environment.
So, first download the project ChangeSet . At the time of this writing, the version number 74794 is relevant.
To demonstrate the capabilities of the engine, it is proposed to launch the SharpMap.VS2008.sln project file in the Trunk folder. In SolutionExplorer, install the WinFormSamples project as StartUp Project.


The right panel of the form shows a set of RadioButton 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 a map.
Similarly, look through the item Gradiet Theme.


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



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

Source: https://habr.com/ru/post/101781/

All Articles