Click here to Skip to main content
Licence 
First Posted 30 Oct 2005
Views 129,200
Bookmarked 131 times

Map component for building GIS applications (GisMap)

By | 30 Oct 2005 | Article
Map component for building GIS and CAD/CAM applications. Reads most of the vector and raster formats, performs coordinate system transformations, accesses aerial photography via web services and more.

Introduction

GisMap is a .NET component for building GIS and CAM/CAD application. It's a part of MVisionTech VisiWorks data visualization framework. GisMap uses Canvas for drawing geometrical shapes and GDAL project for handling different geographical vector and raster formats.

Maps are essential to locate objects distributed over wide areas. There are many kinds of applications that require geographical presentation of data, such as trip organizers, assets management systems, fleet management, GPS tracking and many others. All these types of system constitute the GIS or Geographical Information System.

A classical GIS system consists of tables with data records related to objects and geometrical shapes representing the objects such as polygons and polylines. Tables in a GIS system represent the different layers in the map. Some layers represent different functional objects such as roads, counties and cities, while others represent different resolutions of the same functional layer such as hi-ways, main roads and all roads. Satellite images and aerial photography are frequently used in combination with other geometrical objects. There are different sources of geographical data, GIS system vendors use different file formats to store data in their system. Some major players in the GIS market are ESRI, MapInfo and Oracle.

GisMap uses the open source library called GDAL (Geographical Data Abstraction Layer) to access different sources of geographical data. GDAL supports most of the raster formats (images) and main vector formats via its OGR library. It also provides classes for geographical coordinate system transformation.

Geographical coordinate system is another story, there are a number of different systems, and some of them are very exotic. The reason is that the Earth is a sphere (well almost) and people like to use square coordinates when they measure things. So for measurements they use the projection of various parts of the sphere on the plane. Then these different projections originated from different places, depending on the state, country or continent is measured.

The most popular coordinate systems are WGS-84 (spherical coordinate system with longitude and latitude) and UTM a system of 60 cylindrical projections of WGS-84.

The picture above shows USA's main roads with aerial image somewhere in Texas. When the user zooms in and out the map, GisMap gets the proper image size and resolution from TerraService web services and displays the vector data from the locally stored shape files. Vector data is organized in layers, where each layer corresponds to different map resolutions. GisMap has two different views of the same geographical data, one for navigation and another for browsing. Two views are synchronized; the small blue rectangle on the navigation view shows the location of the second view.

The layer control can be used to adjust the order and visibility of different layers. For every layer the user can specify the minimum and maximum scale to switch from course view to detailed one.

GisMap has a DataGrid showing the attributes of geographical objects in the map, when the map is in "find" mode and an object has been selected GisMap brings a record related to the selected shape.

Using the code

The main purpose of having a Map component is using it in other applications.

  // first we need a canvas to draw our maps:
  Canvas canvasGIS = new Canvas();
  ...
  // then we create an object GisSelector that binds 
  // graphical shape representation with its tabular data:
  GisSelector gisSelector = new GisSelector();
  gisSelector.setCanvas(canvasGIS);
  ...
  // To open vector geographical data 
  // (ESRI shape file for example) we use GisSelector,
  // openGisFile returns list of data layers 
  // availible in the file
  ArrayList al = gisSelector.openGisFile(fname);
  ...
  // To open GeoTif images or other raster 
  // formats supportes by GDAL library
  // we need to create image shape object derived 
  // from CanvasItem and attach it to the canvas:
  GeomModel.CanvasLayer lay1 = 
      new GeomModel.CanvasLayer("geo_image",Color.BlueViolet,0,true);
  GDalGIS.GdalImageCanvasItem geo_im = 
      new GdalImageCanvasItem(im_fname,lay1);
  canvasGIS.AddShape(geo_im);
  ...
 // There is another image object that encapsulates 
 // TerraService aireal photography Web Services:
  GeomModel.CanvasLayer lay2 = 
      new GeomModel.CanvasLayer("terra_image",Color.BlueViolet,0,true);
 TerraService.TerraServiceImage t_im = 
      new TerraService.TerraServiceImage(
          "http:// terraserver-usa.com/ogcmap.ashx",lay2);
 this.canvasGIS.AddShape(t_im);

Design

GisMap uses the Canvas component for creating graphics and GDAL data abstraction to access geographical data. For aerial photography, it uses Microsoft's TerraServise, a thing of beauty. It covers the whole of USA with 1m per pixel resolution. GisMap uses OpenGIS Web Map standard (OGC Web Map Server) to access the data.

The class diagram below shows the main classes of GisMap component. It uses the Canvas control and its geometrical model (GeomModel) to display maps and GDAL classes to deal with GIS data, coordinate systems and transformations.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Eduard Baranovsky

Web Developer

Canada Canada

Member

Baranovsky Eduard has been a software developer for more then 10 years. He has an experence in image processing, computer graphics and distributed systems design.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralImage Processing, Geo TIFF etc. PinmemberRajeswari, T.2:21 12 Jun '10  
GeneralMy vote of 1 Pinmemberhm792193617:41 7 Oct '09  
GeneralGDAL exception with raster images PinmemberThabet Tech6:00 16 Jun '09  
GeneralRe: GDAL exception with raster images Pinmemberhomerhuang15:50 20 Apr '10  
GeneralArial Photograph... Pinmembermbaocha21:59 3 May '09  
RantAdvice... PinmemberMax_Longshaft11:45 15 Jun '08  
Generalproblems in Visual Studio 2005 Pinmemberdavjer12:27 30 Aug '07  
GeneralShowing locations on the map Pinmembersylvesterg3:13 20 Mar '07  
GeneralCould not generate GDAL.DLL Pinmemberbenhchen11:30 1 Feb '06  
GeneralMissing "gdal-priv.h" Pinmemberbenhchen5:05 27 Jan '06  
GeneralRe: Missing "gdal-priv.h" PinmemberEduard Baranovsky4:46 30 Jan '06  
Generallicense of source code Pinmembermpaul426:50 21 Nov '05  
GeneralRe: license of source code PinmemberEduard Baranovsky5:28 23 Nov '05  
GeneralRe: license of source code PinmemberJohn Cardinal5:59 7 Nov '07  
GeneralI wasn't aware... PinmemberAndy_CAnfield13:40 31 Oct '05  
GeneralRe: I wasn't aware... PinmemberEduard Baranovsky2:55 1 Nov '05  
GeneralCool stuff!!! PinmemberPaul Voicu10:47 31 Oct '05  
GeneralRe: Cool stuff!!! PinmemberEduard Baranovsky3:28 1 Nov '05  
GeneralHelping new users PinmemberSteveAbbott22:32 30 Oct '05  
GeneralRe: Helping new users PinmemberEduard Baranovsky4:24 31 Oct '05  
GeneralRe: Helping new users PinmemberEduard Baranovsky16:57 31 Oct '05  
GeneralRe: Helping new users PinmemberSteveAbbott21:37 31 Oct '05  
I'm afraid that I'm still confused. If I click on VisWorks.sln I still get the message that it's under source control (I can fix this by editing the .sln so this isn't a real problem) but I still don't see what I have to do in order to use the key controls:
1. CanvasControl - generic 2D graphics presentaion and drawing component.
2. GisControl (includes GisMap) - GIS layers selector and map view controls.
3. WorkSpace - layout manager, creates placeholders for visualization controls
4. VisiBlocks - adapters around visualization controls for connection with layout manager.
 
If I go to the original sub-projects I find, for example, that GisControl offers to create Geometry.dll and if I open CanvasControl.csproj it also offers to create Geometry .dll. etc. If I try to compile any of them I get various problems. I don't see why VisWorks.sln doesn't compile everything and create the correct .dll links.
 
I'm sure this is my ignorance about how these complex projects fit together, but usually I don't have a problem creating a bunch of .dlls and making references to them. Where am I going wrong?
 
One other detail - the downloads near the top don't have the correct file sizes. The Bin is quite large, for example.
 
Sorry to sound negative when you've created something so marvellous!

 
Steve
GeneralRe: Helping new users PinmemberEduard Baranovsky3:41 2 Nov '05  
GeneralRe: Helping new users Pinmembersimondeanm14:52 1 Dec '05  
GeneralRe: Helping new users PinmemberEduard Baranovsky3:36 5 Dec '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120529.1 | Last Updated 30 Oct 2005
Article Copyright 2005 by Eduard Baranovsky
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid