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

Unexpected route
Last Post 02-17-2010 12:13 PM by Val. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
AdolfoUser is Offline
Level 1
Level 1
Posts:28
Avatar

--
02-08-2010 12:16 PM

 I have a street shapefile of my city. I viewed it in ArcView and everything looks fine about it. I used Map Suite Routing Explorer to build the rtg and rtx files. Then, with the code below I want to get the route between two points on it and as you can see, I have a strange route. I wonder what the problem is. Is it the data? Why isn't it working with my data?

 

 

 


// Set the Map Unit and current extent
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.LightGoldenrodYellow);
            
            // Define a new layer to render the Medellin streets
            ShapeFileFeatureLayer StreetLayer = new ShapeFileFeatureLayer(@"..\..\Data\Routing\Medellin.shp");
            StreetLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad3;
            StreetLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Name", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Black);
            StreetLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            LayerOverlay StreetOverlay = new LayerOverlay();
            StreetOverlay.Layers.Add("MedellinStreetsLayer", StreetLayer);
            winformsMap1.Overlays.Add("MedellinStreetOverlay", StreetOverlay);

            //StreetLayer.Open();
            winformsMap1.CurrentExtent = new RectangleShape(-75.6033, 6.2488, -75.5872, 6.2386);  
            //StreetLayer.Close();

            // Define a Routing layer to render the route and stops
            RoutingLayer routingLayer = new RoutingLayer();
            StreetLayer.Open();

            Collection<Feature> features1 = StreetLayer.FeatureSource.GetFeaturesByColumnValue("OSM_ID", "33179250");
            Collection<Feature> features2 = StreetLayer.FeatureSource.GetFeaturesByColumnValue("OSM_ID", "31540427");

            routingLayer.StartPoint = features1[0].GetShape().GetCenterPoint();
            
            routingLayer.EndPoint = features2[0].GetShape().GetCenterPoint();
            StreetLayer.Close();

            LayerOverlay routingOverlay = new LayerOverlay();
            routingOverlay.Layers.Add("RoutingLayer", routingLayer);

            winformsMap1.Overlays.Add("RoutingOverlay", routingOverlay);

            RtgRoutingSource rtgRoutingSource = new RtgRoutingSource(@"..\..\Data\Routing\Medellin.rtg");
            RoutingEngine routingEngine = new RoutingEngine(rtgRoutingSource, StreetLayer.FeatureSource);


            winformsMap1.Overlays["RoutingOverlay"].Lock.EnterWriteLock();
            try
            {
                routingLayer.Routes.Clear();
                routingLayer.Routes.Add(routingEngine.GetRoute(routingLayer.StartPoint, routingLayer.EndPoint).Route); 
                
            }
            finally
            {
                winformsMap1.Overlays["RoutingOverlay"].Lock.ExitWriteLock();
            }


            winformsMap1.Refresh();
AdolfoUser is Offline
Level 1
Level 1
Posts:28
Avatar

--
02-08-2010 12:24 PM

 I send to support@thinkgeo.com the street shapefile used in this example.

Thank you.

JohnnyUser is Offline
MVP
MVP
Posts:571
Avatar

--
02-10-2010 04:47 AM

 

Adolfo,
 
It’s proved that it’s a bug but fixed now, please login on the http://helpdesk.thinkgeo.com with your own username and password and download the updated package from “My downloads” or “Evaluation Daily Builds”. Below is the test screen shot with "medellin" street data.
 
 
Thanks for your handing the error.
 
Johnny,
ValUser is Offline
MVP
MVP
Posts:799
Avatar

--
02-17-2010 12:13 PM

 For our Discussion Forum users, I would to show the result of the route with the same data and same start/end points after the bug fix:

Thank you so much Map Suite development team!

 

You are not authorized to post a reply.

Active Forums 4.2