Register  |  Login
ThinkGeo - GPS Tracking and Mapping Solutions  |  Home  |  Cygnus Track  |   Code Community

Discussion Forums

The online community for users of Map Suite GIS components

RSS Feed Available AddThis - Bookmarking and Sharing Button Printer Friendly

PrevPrev NextNext

Map Suite Desktop Edition 4.0 Winforms QuickStart Guide

Posted by ThinkGeo on 11-18-2008 12:51 PM

The Map Suite Desktop Edition illustrated Winforms QuickStart Guide will guide you through the process of creating a sample application and will help you become familiar with Map Suite. This edition of the QuickStart Guide supports Desktop Edition 4.0.0.0 and higher, and will show you how to create a Winforms application. If you want to build a WPF application, please see the WPF QuickStart Guide instead.

Download Sample Code From This Exercise

Welcome to Map Suite™ from ThinkGeo, a full featured mapping control that makes it easy for any Microsoft .NET developer to add mapping functionality to a Microsoft .NET application quickly and efficiently. Using the intuitive object model, even developers inexperienced in Geographic Information Systems (GIS) can have fully functional maps working in minutes.

The purpose of this guide is to help you get started quickly to building your own spatially aware applications. Like any new software, there is some learning to be done.

How do we start to learn how to take advantage of the power of Map Suite? The best way is to make a sample application with it.

(For the purposes of this guide, let's assume we have installed the Map Suite Desktop Edition 4.0 to the default folder "C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\")

Setting up the Environment

Let's start with a new Windows Forms project in the Visual Studio.NET 2008 IDE and call it HelloWorld (see Figure 1). We can create the project with .NET Framework 3.5, 3.0 or 2.0.

Screenshot

Figure 1. Creating a new project in the Visual Studio.NET 2008 IDE.

The project HelloWorld is created in a new solution called HelloWorld. The wizard creates a single Windows Form.

Next we need to put a Map control on the Form from our Toolbox. The Map control is located on the Toolbox under Windows Forms (see Figure 2). If you do not see these controls, you will need to add them to your Toolbox manually.

Adding the Map Controls to the Visual Studio.NET IDE Toolbar

1. When you first open the Visual Studio.NET IDE after installing Map Suite, you may not see the controls in the Toolbox. You will need to follow these steps to add the controls.

Hover on Toolbox and right click anywhere on list of controls. You will get a pop-up menu. Choose "Choose Items...".

Screenshot

2. A dialogue box to Choose Toolbox Items will appear. You will need to select the .NET Framework Components tab and then click the Browse button. Finally navigate to the "C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Developer Reference\DesktopEdition" folder and select the DesktopEdition.dll.

Screenshot

3. You should now have the Map Control available in your Toolbox as shown in Figure 2 below.

Screenshot

Figure 2. The Map Controls under the Toolbox window.

Adding the Map Control to your Windows Form

We need to add MapSuiteCore.dll to the reference. Right-click the project in solution explorer and select "Add Reference...", navigate to the "C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Developer Reference\DesktopEdition" folder and select MapSuiteCore.dll.

Screenshot

Draw the Map control on the form by clicking on the Map Control object in the Toolbox and then dragging and dropping (using the left mouse button) to the size you desire. You can leave the name of the Map control to winformsMap1. Our map will display in it.

Screenshot

Now that we have our MapSuiteCore.dll referenced and a Map Control added. We are ready for adding the code.

Map Suite Desktop "Hello World" Sample

After this section, you will be able to draw a map with the MapControl using your own data. At the very beginning, let's have a look at the data and the important objects we will use.

Shapefiles

Map Suite Desktop Edition 4.0 supports multiple kinds of data sources, such as SQL Server 2008, Postgre, Oracle, etc. Here we will provide an introduction to Shapefiles which we will use in this Quick Start Guide.

Simply put, Shapefiles are used by Map Suite to provide data that we will use to draw our map. Shapefiles store binary vector coordinates to be used by the component. They have a .shp extension. Shapefiles also come with two supplementary files that help Map Suite to work with the data.

The first supplementary file is called the .shx file. Its purpose is to provide a simple index of the main Shapefile. It tells the Map Suite component when to start reading binary data and when to stop. It is much like a directory for reading the binary data, sort of a lookup mechanism.

The second supplementary file is the .dbf file. This file holds tabular data associated with the main Shapefile. For example, the Shapefile may have the coordinates for a line to be drawn that represents a road. The .dbf file may have information to tell you what the name of the road is or what type of road it is, such as county road, state road, interstate highway, etc.

All three files need to reside in the same directory as the main Shapefile (.shp), but the Map Suite component only expects you to designate the name and file path of the main Shapefile. Next, when we discuss layer, you will start understanding a little more about how maps are constructed in Map Suite using the shape data.

ShapeFileFeatureLayers

A ShapeFileFeatureLayer in a map correlates to a single Shapefile, such as networks of roads. You can think of layers much like actual terrain in the real world. The bare earth might be a layer and has either physically defined boundaries, such as a fence around a military installation, or legal boundaries, such as the border of a country. Another layer on top of that might be roads that are built upon the bare earth. It is important to understand this when working with layers, as they need to be added in the logical order you might expect so that they can be visualized correctly from above. In other words, you would not want to lay down roads and then cover them with earth, because they could not be seen or used by vehicles.

How do we create and add layers? First, you should know that there are three types of styles that layers represent. As mentioned above, it follows logically that you would create and add layers based on how they should be viewed, so naturally you might start with some polygons, such as the outline of a country and all of the regions within it. You might then lay down lines that represent rivers and roads and then finally you might lay down points like cities or places of interest. Again, keep in mind that logic will dictate what works best. For instance, laying down roads and then rivers would put rivers on top of roads when it should more than likely be the other way around (the exception here might be a tunnel!).

Map

A Map object is the highest level object that encompasses layers and some other objects. For now, you can think of a Map as a set of layers, which can render each layer and present you with a map based on actions performed, such as moving in and out, or panning across the surface to view another part of the map.

Styles

Shapefiles provide the data, but Styles are the way you color and draw them. You can specify the color of the country, the width of a road, the shape (triangle, circle, cross etc) of a point, and so on.

Map Suite has many preset Styles built in, including predefined Styles for roads, rivers, cities, countries, and more. This makes it easier to create great looking maps without a lot of hassle.

PresetZoomLevels

Styles define the way we visually represent the data, while ZoomLevels define the situation in which we want to display them. The reason why we need ZoomLevels is because we may want to display a small town when we are zoomed into a state, but we definitely don't want to display that town when we are zoomed out and looking at the entire country.

We have provided the 20 most common scales, from ZoomLevel01 to ZoomLevel20, at which you may want to change the way your data looks. What is scale? Scale indicates how much the given area has been reduced. If a road is 10,000 inches long in the real world and a map depicts this length as 1 inch on the screen, then we say the scale of this map is 1:10,000. Now let's say ZoomLevel02 uses a scale of 1:500 and ZoomLevel03 uses a scale of 1:1200. This means the map with a current scale of 1:1000 matches ZoomLevel03, the ZoomLevel whose scale is the closest to that.

PresetZoomLevels has a very useful property called "ZoomLevel.ApplyUntilZoomLevel", which you can very easily use to extend your ZoomLevels. Let's say you want a particular Style to be visible at ZoomLevel03 through ZoomLevel10. To make that work, we can simply code as follows:

worldLayer.ZoomLevelSet.ZoomLevel03.DefaultAreaStyle = AreaStyles.Country1; 
worldLayer.ZoomLevelSet.ZoomLevel03.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;

Map Suite Desktop "Hello World"

In creating our "Hello World" sample application, our first step is to set references to the Map Suite Core and Map Suite DesktopEdition workspaces at the very top of our code, as we will use many classes within that. We do this so that we do not have to use the fully qualified name of the Map Suite classes throughout our code. Setting a reference to the Map Suite workspace can be done in the "code-behind" of the Form by selecting the Form and hitting the F7 function key. Set the reference like this:

using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.DesktopEdition;

Now let's look at a code sample to bring this concept to fruition. We'll look at Shapefiles relating to the entire world. In our example, we have one such Shapefile:

  • The borders of every country in the world (Countries02.shp)

(NOTE: The data used in this sample can be found in the installation folder under \Samples\SampleData\Data. Figure 3 shows that folder)

Screenshot

Figure 3. The data used in this sample.

Our next step is to define and add our Layers. Here is the code to use for our example. All of the following code can be placed in the Form1_Load event of the form.


private void Form1_Load(object sender, EventArgs e)
    {
        // Set the Map Unit. The reason for setting it to DecimalDegrees is that is what the shapefile’s unit of measure is inherently in.
        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
        
        // We create a new Layer and pass the path to a Shapefile into its constructor. 
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\Countries02.shp");
        
        // Set the worldLayer with a preset Style, as AreaStyles.Country1 has YellowGreen background and black border, our worldLayer will have the same render style.  
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        
        // This setting will apply from ZoonLevel01 to ZoomLevel20, that means we can see the world the same style with ZoomLevel01 all the time no matter how far we zoom out/in. 
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        // Create a new Layer Overlay to hold the layer we just created
        LayerOverlay layerOverlay = new LayerOverlay();
        
        // Add the shapefile layer to the layer overlay
        layerOverlay.Layers.Add(worldLayer);
        
        // We need to add the layer overlay to Map.
        winformsMap1.Overlays.Add(layerOverlay);
        
        // Set a proper extent for the Map.  
        winformsMap1.CurrentExtent = new RectangleShape(0, 78, 30, 26);
        
        // We now need to call the Refresh() method of the Map control so that the Map can redraw based on the data that has been provided.
        winformsMap1.Refresh();
    }

If you compile and run what you have now, your map should look like the one below. (see Figure 4).

Screenshot

Figure 4. A Simple map of Europe.

So what has occurred here? We have created a layer and added it to the Map, and the Map has rendered it according to its default style parameters. Also, we have used ZoomLevel to display the map the way we want.

NOTE: It is important that the MapUnit property of a Map object be set using the GeographyUnit Enumeration. This is because Shapefiles only store binary vector coordinates, which can be in DecimalDegree, feet, meters, etc., and our map has no idea about what the unit of measurement is until we set it. This information is normally found somewhere in the documentation or within the supplemental data file as discussed in the section on Shapefiles.

Navigate the Map

With the above code, not only can you display a map, but you can also navigate it. You can pan by dragging the map, zoom in by double-clicking, track zoom in by drawing a rectangle with your left mouse button mouse while holding the shift key, or zoom in and out by using the mouse wheel. Very powerful for just couple lines of code, isn't it?

That was an easy start! Now, let's add another Shapefile to the sample so that we will have a total of two layers:

  1. The borders of every country in the world (Countries02.shp)
  2. The capitals of the world countries (WorldCapitals.shp)

private void Form1_Load(object sender, EventArgs e)
    {
        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
        
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\Countries02.shp");
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\WorldCapitals.shp");
        // Similarly, we use the presetPointStyle for cities.     
        capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital3;
        // This setting also applies from ZoonLevel01 to ZoomLevel20, that means we can see city symbols the same style with ZoomLevel01 all the time. 
        capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        LayerOverlay layerOverlay = new LayerOverlay();
        layerOverlay.Layers.Add(worldLayer);
        // We need to add both of the new layers to the Layer OverLay. 
        layerOverlay.Layers.Add(capitalLayer);
        
        winformsMap1.Overlays.Add(layerOverlay);
        winformsMap1.CurrentExtent = new RectangleShape(0, 78, 30, 26);
        
        winformsMap1.Refresh();
    }

And the result is as following (Figure 5):

Screenshot

Figure 5. Europe map with 2 layers.

How to Use GeoTextStyle

TextStyle

TextStyle are used to label items on map. As every Shapefile has a relative .dbf file, which includes descriptions for every record, the most common way to use TextStyles is for labeling. For example, WorldCapital Shapefile's corresponding .dbf file contains the field "CITY_NAME". We can use this field to label the cities on our map.

Screenshot

Map Suite has many TextStyles built in, which will help us quickly design attractive labels for the cities on our map. We can just pick the TextStyle we like and use it.


private void Form1_Load(object sender, EventArgs e)
    {
        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
        
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\Countries02.shp");
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\WorldCapitals.shp");
        // Similarly, we use the presetPointStyle for cities. 
        capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital3;
        // This setting also applies from ZoonLevel01 to ZoomLevel20, that means we can see city symbols the same style with ZoomLevel01 all the time. 
        capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        // We create a new Layer for labeling the capitals.
        ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\WorldCapitals.shp");
        // We use the preset TextStyle. Here we passed in the “CITY_NAME”, which is the name of the field we want to label on map.
        capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital3("CITY_NAME");
        capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        // As the map is drawn by tiles, it needs to draw on the margin to make sure the text is complete after we joining the tiles together.
        // Change the number to another one (for example 0) and you can see the difference expecially when panning.
        capitalLabelLayer.DrawingMarginPercentage = 50;
        
        LayerOverlay layerOverlay = new LayerOverlay();
        layerOverlay.Layers.Add(worldLayer);
        layerOverlay.Layers.Add(capitalLayer);
        layerOverlay.Layers.Add(capitalLabelLayer);
        
        winformsMap1.Overlays.Add(layerOverlay);
        winformsMap1.CurrentExtent = new RectangleShape(0, 78, 30, 26);
        
        winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
        winformsMap1.Refresh();
    }

The result is as following (Figure 6):

Screenshot

Figure 6. Europe map with TextStyle.

Now that we know how to render text and render symbols, let's define two different ZoomLevels in one single layer, and create our own custom Style and TextStyle.


private void Form1_Load(object sender, EventArgs e)
    {
        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
        
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\Countries02.shp");
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\WorldCapitals.shp");
        // We can customize our own Style. Here we passed in a color and a size.
        capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown);
        // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore.
        capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;
        
        capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.Capital3;
        // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more.
        capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        
        ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\WorldCapitals.shp");
        // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color.
        capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
        // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05. 
        capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;
        
        capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyles.Capital3("CITY_NAME");
        // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20. 
        capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        capitalLabelLayer.DrawingMarginPercentage = 50;
        
        LayerOverlay layerOverlay = new LayerOverlay();
        layerOverlay.Layers.Add(worldLayer);
        layerOverlay.Layers.Add(capitalLayer);
        layerOverlay.Layers.Add(capitalLabelLayer);
        
        winformsMap1.Overlays.Add(layerOverlay);
        winformsMap1.CurrentExtent = new RectangleShape(0, 78, 30, 26);
        
        winformsMap1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
        winformsMap1.Refresh();
    }

Can you imagine what the map will look like now? Below is the result. At first it appears like figure 7, and the map changes to figure 8 as you zoom in.

Screenshot

Figure 7. Europe Map with two ZoomLevels, before Zoom In.

Screenshot

Figure 8. Europe Map with two ZoomLevels, after Zoom In.

Notes:

Because Desktop Edition uses multi-threading internally for drawing, if you want to change an overlay after the map is initialized, you need to lock the overlay first to avoid threading conflicts. For more information, please have a look at our "How Do I?" sample applications that come with the product.

Summary

You now know the basics of using the Map Suite Map control and be able to get started adding functionality into your own applications. Let's recap what we have learned about the object relationships and how the pieces of Map Suite work together:

  1. It is of the utmost importance that the units (feet, meters, decimal degrees, etc.) be set properly for the Map control based on the data.
  2. Shapefiles provide the data used by a Map control to render a map.
  3. A Map is the basic control that contains all of the other objects that are used to tell how the map is to be rendered.
  4. A Map has one-to-many Layers. A Layer correlates one-to-one with a shape file (.shp).
  5. A Layer can have one-to-many ZoomLevels. ZoomLevels help to define ranges (upper and lower) of when a Layer should be shown or hidden.

If you have question on anything covered in this quick start guide, the ThinkGeo Support Team is ready and available to help. If we can be of any assistance, please contact us using the below information:

Free Discussion Forums: ThinkGeo Discussion Forums
Pre-Sales & Customer Support: ThinkGeo Customer Portal
Support Phone: 1-866-847-7510
1-785-727-4133 (Outside North America)
Web Site: http://thinkgeo.com

Download Sample Code From This Exercise

30 Comments

arshadUser is Offline
03-21-2010 03:43 AM
Avatar
I fellow all the step and when running the applicaiton it is not showing any map. just empty map is display on the form, i am using vs 2008, and creating on window form, i also download the smaple code and when ruinning it is give erro winformsMap1.Refresh(); when i remove it and run the same thing is happend. the empty screen will display.

any one can help. i am new to map suit. and need help, my requirement for my project is to display the map of one country with road, and point he petrol pumps on that road, and when click on any petrol pump, it's informaiton is display on some form.
JamesUser is Offline
03-21-2010 11:22 PM
Avatar
Arshad,

What exception does it throw? Is it the FileNotFoundException(The file specified does not exist.). The reason is that this sample code is for beta version, you can see the file path contains "beta", but now I have released it, so we remove the "beta" for the installation folder. You can try to modify the file path string to solve this problem.

If the problem is not that, please let me know if you modify any code and which verision of DesktopEdition do you use?

Thanks
James
arshadUser is Offline
03-22-2010 06:10 AM
Avatar
the line will be read in visual studio so i have no idea that what was the problem, i will do the all steps again and send u detail , and also till me i only need pakistan map with only road, so how can i do that is there any example avalibe for that. and thanks for your reply
arshadUser is Offline
03-22-2010 06:25 AM
Avatar
on this line
winformsMap1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
it say winformsMap1 does not contain defination of BackgroundBrush and when i comments out this line
then on the last line
winformsMap1.Refresh();
The file specified does not exist.
i download the same sample from here and when running it is give me error. i am using the 3.0 disktop version.
ValUser is Offline
03-22-2010 02:49 PM
Avatar
I think that the main problem for you is that you seem to not have the path for your files correctly set. This is more a general programming issue than a issue specific to Map Suite. Please, make sure that you have the path string set correctly to where your files are and it should run correctly.
arshadUser is Offline
03-23-2010 07:18 AM
Avatar
Thanks for your response, now it is working, the map is display, can u give me some links to resource that how i will create map, i need pakistan map with road level, so how i will do that..from where i will get that map, bz i need to work on a proeject in which we need all petrol pum of gis system.
RyanUser is Offline
03-23-2010 10:38 AM
Avatar

arshad,

You have a couple of options for your map data.

  • You could use Google Maps, Bing Maps or another other WMS service.
  • You could use shapefile data for your maps. We have a map data product named World Map Kit that contains street level detail for the USA and Canada and major road detail for the rest of the world. You can demo the World Map Kit here: http://maps.thinkgeo.com
  • You could also source your own shapefile data perhaps from your local or national GIS department.
RAJAGOPALUser is Offline
03-24-2010 01:59 AM
Avatar

there is no need to apply this apllication to the another programmes and software we can use dirctly

YaleUser is Offline
03-24-2010 03:01 AM
Avatar
RAJAGOPAL,

I am sorry I could not understand what problem you are facing. Could you make it more clear or give us more information?

Thanks.

Yale
arshadUser is Offline
03-24-2010 03:43 AM
Avatar
Yale

how i can use google map, bz it's format is different when i save the google map, i do that and convert that file to .shp file using one online convertor but still is not working, can you help me for that
ValUser is Offline
03-24-2010 11:06 AM
Avatar
You cannot convert Google map to shapefile (.shp) format. Google map is raster based (image) and shapefiles are vector based. It is just not possible to do that.
For another source of data, there is also high end data providers such as Navteq but they are pretty expensive.
SHWETAUser is Offline
06-23-2010 07:45 AM
Avatar
Sir
I'm using the dektop edition but even after following the steps it is not showing the map,it is running but not displaying the map,in the window form
pl can anyone guide me about the problem
ValUser is Offline
06-23-2010 07:00 PM
Avatar
If you are following exactely the steps as explained in this QuickStart guide, you should not have that problem. Or it could be because, you are using your own data and some parameters are differents compared to this example. Can you give us more information, please?
ValUser is Offline
06-23-2010 07:02 PM
Avatar
If you are following exactely the steps as explained in this QuickStart guide, you should not have that problem. Or it could be because, you are using your own data and some parameters are differents compared to this example. Can you give us more information, please?
ValUser is Offline
06-23-2010 07:02 PM
Avatar
If you are following exactely the steps as explained in this QuickStart guide, you should not have that problem. Or it could be because, you are using your own data and some parameters are differents compared to this example. Can you give us more information, please?
SHWETAUser is Offline
06-24-2010 12:29 AM
Avatar
Yes ,I had followed all steps except
ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer("~\Maps\xyz_ds.shp");
as i had saved my maps in the Map folder in the same project.
YaleUser is Offline
06-24-2010 01:57 AM
Avatar
SHWETA,

Could you open your shape file(xyz_ds.shp) in MapSuiteExplorer which can be open in its shortcut in StartMenu\All Programs\ThinkGeo\MapSuite DesktopEdition 4.0\Map Suite Explorer.

I suspect the data in the xyz_ds.shp is in other units instead of DecimalDegrees, can you make sure about this?

Thanks.

Yale
SHWETAUser is Offline
06-24-2010 02:40 AM
Avatar
Sir
when i opened it in MapSuite Explorer,it is saying the file is not having spatial index and if it should create it.And more over the s/w which i have installed is Map Suite DesktopEdition 3.0 ,so their any version problem or what ,where will i get version4.0
Thanks
SHWETAUser is Offline
06-24-2010 07:31 AM
Avatar

Sir
Now using the same maps in MapSuite Desktop Edition 4.0 it is giving FileNotFoundException
ShapeFileFeatureLayer inLayer = new ShapeFileFeatureLayer(@"~\Maps\india_st.shp");
....
winformsMap1.Refresh();
it is showing on Refresh() cmd .

YaleUser is Offline
06-24-2010 08:16 PM
Avatar
SHWETA,

I think I know where the problem is now. We need the SpatialIndex for the shape file to be loaded in the Map Control. The easiest way to create it is by using the MapSuite Explorer as you have encountered. The other way is to use the code to implement it, such as :
ShapeFileFeatureLayer.BuildIndexFile(@"~\Maps\india_st.shp", BuildIndexMode.DoNotRebuild);

Any more questions just feel free to let me know.

Thanks.

Yale
SHWETAUser is Offline
06-25-2010 12:39 AM
Avatar
Sir
now also when i am writng the code
ShapeFileFeatureLayer inLayer = new ShapeFileFeatureLayer(@"~\Maps\india_st.shp");
ShapeFileFeatureLayer.BuildIndexFile(@"~\Maps\india_st.shp", BuildIndexMode.DoNotRebuild);
it is still giving the same error in the above line code as it was giving on
winformsMap1.Refresh();


YaleUser is Offline
06-25-2010 12:52 AM
Avatar
SHWETA,

It would be nice if you could send us the data you are trying to test against, we will try to dig out the problem and send you a complete sample. You could send the data to our support and ask for forward it to Yale.

Any more questions just feel free to let me know.

Thanks.

Yale
SHWETAUser is Offline
06-28-2010 01:29 AM
Avatar
Sir,
Thanks a lot my map is displaying now,bt i'm having few more queries.
Thanks
Shweta
YaleUser is Offline
06-28-2010 01:52 AM
Avatar
SHWETA,

Any more questions just feel free to ask, it is better you could do that on its corresponding discussion forum, we are always ready to help you.

Thanks.

Yale
SHWETAUser is Offline
06-29-2010 07:12 AM
Avatar
Sir
I want to display a map tool i.e the zoom tool, a mini map, a legend on the same map ,but not able to find any help code,which i saw was for online applications .
Thanking You
Shweta
ValUser is Offline
06-29-2010 12:07 PM
Avatar

Shweta,

 I think you had a similar question in that Discussion Forum post:

gis.thinkgeo.com/Support/Discussion...fault.aspx

Thank you.

IoustinosUser is Offline
06-30-2010 06:15 AM
Avatar
Hi there, i am trying out the API and started from here.
It appears that my map comes out very small (while the winformmap1 object has size 900 X 600). I am not sure what currentExtent is and how it works and there is no clear documentation on it.

The property current extent of the winformmap is -69.5250000000001,25.3125,1257.975,-818.4375....What is this?

Moreover it seems that i can drag the map arround. I do not want this. How can i disable it?

Thank you in advance. I need to get starting so i can decide whether i am buying the licence.
YaleUser is Offline
06-30-2010 11:35 PM
Avatar

 

Ioustinos,
 
Thanks for your post and interests in Map Suite component.
Property CurrentExtent in the Map Control will determines the view are of the map shown in the control, try following code to set the control to fix the layer exactly, of course, you could set any reasonable extent as you want.
 

layer.Open();
winformsMap1.CurrentExtent = layer.GetBoundingBox();
layer.Close();
Following code shows you how to disable the pan ability:
 

winformsMap1.ExtentOverlay.PanMode = MapPanMode.Disabled;
 
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale
IoustinosUser is Offline
07-01-2010 05:30 AM
Avatar
Thanks!
Much better now!
The map seems big enough but still it will not occupy the full extent of the control that i added on my form.
YaleUser is Offline
07-01-2010 10:07 PM
Avatar
Ioustinos,

Thanks for letting us know your status.

Yes, it is not full fill up because it is snapped, if you want, you could set the extent a bit large to fit it in next zoom level just like the zooming out effects.

Any more questions just feel free to let us know.

Thanks.

Yale
You are not authorized to post a reply.
Active Forums 4.2