It’s simple to get it with RoutingLayer class, which allow us to define the StartPointStyle, EndPointStyle and stop points style, all of them are PointStyle that can be customize bitmap or something else. We also can display the different paths in different colors using ClassBreakStyle based on distance or ValueStyle based on some custom values. Please refer to the installation DesktopEdition samples in “Style” folder.
Many thanks for your reply. The figure you shown is exactly what i want. I used PointStyle of StartPointStyle and i can load my own bitmap now. But i am not able to put my text over this start, end or stop point. And also, i want my custom bitmap along with my custom message.
Hi val, Thanks a lot for your reply. The link you provided actually helped a lot. But when i try to implement this code in my application it shows custom marks but it doesnt show custom labels. Here is the code-
InitializeComponent();
winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-97.7970203443604, 30.3231958204346, -97.6787456556397, 30.2358201795654); ShapeFileFeatureLayer austinStreetsLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Routing Evaluation Edition 3.0\HowDoISamples\SampleData\Austinstreets.shp"); austinStreetsLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad4; austinStreetsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay austinStreetOverlay = new LayerOverlay(); austinStreetOverlay.Layers.Add("austinStreetsLayer", austinStreetsLayer); winformsMap1.Overlays.Add("austinStreetOverlay", austinStreetOverlay); mapEngine.StaticLayers.Add("AustinStreets", austinStreetsLayer); // Define a Routing layer to render the path and stops
LayerOverlay ptoverlay = new LayerOverlay(); ptoverlay.Layers.Add("PointLayer", pointsInMemoryFeatureLayer); winformsMap1.Overlays.Add("PointOverlay", ptoverlay);
winformsMap1.Refresh();
This code shows green , yellow and red marks at start stop and end points. But i could not find the labels like start, stop1, stop2, End. Please help me out…
It is a little bit difficult to look at a bulk of code outside its context, without being able to run it and see what is happening. But by looking at your code, I could not find where you set up the Style to have the labels showing. You will notice that in the project “Routing Styles”, there is the line:
Hi val, There is one more problem. Can you tell me how can i show two different paths at the same time in different colors? For exmample From A to B there is one route say X and another route say Y. I need to show both of these routes in the map in different colors? How can i do it?
Hello Ben, I am sorry for not explaining my problem clearly. Actually i am asking how to get alternative routes between two points. I want to show both routes (original and alternative) on the map in different colors. The solution you told me works when we have all the co-ordinates in between source and destination for original routes and alternative routes.
I want to make sure exactely what you are asking for. You want to show on the map the different routes based on different algorithms from a start and en end point. Correct?
Sorry val for late reply… Actually what i want is all the possible paths from source to destination at the same time. What you are telling me is may be shortest path from soruce to destination using different algorithms.
There is one more problem Yale… I downloaded spain map from ESRI website. This map contains .shp, .shx, .dbf and .prj files. When i specify the path of shp file application throws an exception saying shp file does not have corresponding idx (index file). If i set RequireIndex property of ShapeFileFeatureLayer class it just shows nothing.
In short can you tell me how can i use shp files of companies other than you. I am posting sample code… please have a look…
private void btn_loadanother_Click(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-97.745827547760484, 30.297694742808115, -97.728208518132988, 30.285123327073894); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)); ShapeFileFeatureLayer roadlayer = new ShapeFileFeatureLayer(@"C:\Documents and Settings\Manoj\Desktop\sample_italy_slovenia_shape (1)\sample_italy-slovenia_shape_gfk_geomarketing\maps\Italy cities over 100K.shp"); // ShapeFileFeatureLayer roadlayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 3.0\Samples\SampleData\Data\Countries02.shp"); roadlayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country2; roadlayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // roadlayer.RequireIndex = false; LayerOverlay shortestLineOverlay = new LayerOverlay(); shortestLineOverlay.Layers.Add("ShortestLineLayer", roadlayer); winformsMap1.Overlays.Add("ShortestLineOverlay", shortestLineOverlay); // winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2); winformsMap1.Refresh();
if I create index file using Mapsuite explorer or using BuildIndexFile funciton it creates a corresponding index file. But map does not show anything… Please help on this issue…
In our experience when a problem as you describe occurs, it is often because the projection of the shapefile is different from Geodetic (decimal degrees). Can you send us the strings you have in the prj files? This is the first thing I would check. Thank you.
Hi Val, Thanks for your reply… Actually i am a beginner in GIS application development. I am sorry for embarassing you for asking basic questions. But before purchasing the software we need to know the capabilites of software. Well, i am sending you the string.
I think according to the projection string, the map unit should be set to DecimalDegree as you have done. So, if you are sure you are setting the correct Style for your data, then I have to doubt there is some special on your data. If possible, could you send us your data?