SharpMap is an easy-to-use mapping library for use in web...
Transcript of SharpMap is an easy-to-use mapping library for use in web...
![Page 1: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/1.jpg)
SharpMap is an easy-to-use mapping library for use in web and desktop applications. It provides access to many types of GIS data, enables
spatial querying of that data, and renders beautiful maps. The engine is written in C# and based on the .Net 4.0 framework. SharpMap is
released under GNU Lesser General Public License.
![Page 2: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/2.jpg)
Supporters of SharpMapSharpMap developers kindly appreciate support from
JetBrains NDepend
NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality
![Page 4: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/4.jpg)
※ Microsoft Visual Studio
• Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. It can produce both native code and managed code.
![Page 5: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/5.jpg)
How to download the Visual Studio• https://www.visualstudio.com/en-us/dn469161
![Page 6: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/6.jpg)
Creating a Form with a MapControl
• 1. Start Visual Studio and create a new Windows Application
In the step we will add a layer to the mapcontrol created in the first step .
![Page 7: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/7.jpg)
![Page 8: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/8.jpg)
![Page 9: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/9.jpg)
• 2. Add references to SharpMap and SharpMap.UI via NuGet Package Manager
![Page 10: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/10.jpg)
![Page 11: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/11.jpg)
• 3. Open the designer for Form1
![Page 12: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/12.jpg)
• 4. In the toolbox, find the General category at the bottom and right click ans choose "Choose Items"
![Page 13: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/13.jpg)
![Page 14: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/14.jpg)
• 5. Browse to SharpMap.UI.dll and add that one (its located in the solution-file directory under packages/SharpMap.UI)
• 6. Click OKYou should now see the sharpmap controls in the general category
![Page 15: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/15.jpg)
7. Drag the MapBox control into your form and you should now have a Map on your form
![Page 16: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/16.jpg)
• 8. Select the control and in the properties dialog. Change the BackgroundColor to White
![Page 17: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/17.jpg)
![Page 18: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/18.jpg)
8. Select the control and in the properties dialog. Change the BackgroundColor to White
![Page 19: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/19.jpg)
In the step you will add a layer to the mapcontrol created in the first step
1. Add a reference to SharpMap.dll if it's not already added2. Open the code for the form by right-clicking the form and choose "View Code"
Example 1: Adding 1 layer to the Map
![Page 20: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/20.jpg)
• 3. Add the following code to the constructor of the form
Example 1: Adding 1 layer to the Map
(The data: states_ugl.shp is located in the zip on the tutorial overview page)
![Page 21: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/21.jpg)
Example 1: Adding 1 layer to the Map• 4. Run the application and you should now see the US states in the map
• 5. Set the Active tool to Pan
6. Run the application again and you should now be able to pan and zoom (by scrolling the mouse-wheel) in the map
![Page 22: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/22.jpg)
Example 2: Styling the layer with UniqueValueRendererIn this step we will style the map with different color dependent on attribute value
Update your maploading code and assign a Theme (UniqueValuesTheme)
![Page 23: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/23.jpg)
Example 2: Styling the layer with UniqueValueRenderer
![Page 24: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/24.jpg)
Example 2: Styling the layer with UniqueValueRenderer
• We can now have a map that looks something like this
![Page 25: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/25.jpg)
Example 3: Adding a WMS-layer to the map
![Page 26: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/26.jpg)
Example 3: Adding a WMS-layer to the map
• now we have a Map with cities shown on them
![Page 27: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/27.jpg)
Example 4: Adding a Tiled layer as Background
1. Add references to BruTile.dll and ProjNet.dll
2. Modify your initialization code to add Open Street Map as a background layer in the mapwe now need to set the Coordinate Transformation and Reverese Coordinate Transformation property on your vector layers for them to be reprojected and line up with the background tiles.
In this step we will see how we can combine online tile-server data together with local data from shapefiles
![Page 28: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/28.jpg)
Example 4: Adding a Tiled layer as Background
![Page 29: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/29.jpg)
Example 4: Adding a Tiled layer as Background
![Page 30: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/30.jpg)
Example 4: Adding a Tiled layer as Background
• 3. Zoom in to nothern US and se how your ShapeFile data lines up with Open Street Map
![Page 31: SharpMap is an easy-to-use mapping library for use in web ...giswin.geo.tsukuba.ac.jp/sis/gis_seminar/20151119shu.pdf · applications. It provides access ... The engine is written](https://reader034.fdocuments.in/reader034/viewer/2022051602/5ae524537f8b9a08778b51e0/html5/thumbnails/31.jpg)