I am facing problem in loading my shapefiel. when the application runs, shape file doesnot display. i have checked its map units and put correct map units but still no solution.
Thanks for your post, could you please provide your shape file to me and I can make some test, to make sure you using the right style, projection, mapunit.
You can attach in this post, or you think your data is private, you can send to forumsupport@thinkgeo.com.
Thanks Gray i have solved this problem. but unfortunately i got an error in creating .rtg for routing. i searched the forum for the solution but i found same problem with same error but not could not find a solution.
The error is :
the decimal degree longitude value you provide was out of range . parameter name : from longitude
Might I suggest you project your shapefile to spherical Mercator or a meters based projection. The routing engine though it can work with decimal degrees is fastest and gives more reliable results when you use a feet or meters projection. The reason is that in meters things are on a grid and the distance in one step of x or Y is know. In decimal degrees one step being one decimal degree has different distances depending on where you are on the earth. One decimal degree is different at the equator then near the poles. Converting the data may solve the error you are running into and also allow for a faster and more accurate result.
On side benefit and something I suggest is to also use meters and then hook to the event that gets called when you create the rtg so you can adjust the weight. By adjusting the weight you can factor in the speed difference between various classifications of roads. My suggestion is to do the Distance / Speed as the weight. You can look at your shapefile data and see if it has a road classification, if so estimate the speed. In this was if you have a 5000 meter road with a speed of 75kph then the weight would be 66.66, this shortens the road as opposed to a speed of 45kph which would yield 111.11 meaning this road seems longer to the algorithm. To do this with decimal degrees is tricky and I don’t suggest it. If you do it this way then you results will be more accurate as it will factor in the faster possible travel speed of highways.
We can provide you with a sample of this is you are interested.
This might be a bug in the Map Suite Explorer in that it always thinks you data is in decimal degrees when generating the rtg file. I suggest you use the direct API as part of the routing engine. Below is a post of a person running into the same thing.
He writes "There is an overload of RtgRoutingSource.GenerateRoutingData that takes GeographyUnit and DistanceUnit; we supply GeographyUnit.Meter and DistanceUnit.Meter and everything worked fine. "
i am building .rtg file with API is this correct method?
ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(@"C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\H_12_Roads.shp"); RtgRoutingSource routingSource = new RtgRoutingSource(@"C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\H_12_Roads.rtg");
For build the routing data(rtg) with API, you can refer HowDoISamples—>BuildingRoutingData, your code will be good but you don’t need RtgRoutingSource routingSource = new RtgRoutingSource(@“C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\H_12_Roads.rtg”);
So have you met problem when you build the rtg file?
when i run this code ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(@“C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\Roads.shp”); RtgRoutingSource routingSource = new RtgRoutingSource(@“C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\Roads.rtg”);
RoutingEngine routingEngine = new RoutingEngine(routingSource, featureSource);
it gives this error :
The decimal degree longitude value you provided was out of range. Parameter name: fromLongitude
and when i add gernerateroutingdata in code
ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(@“C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\Roads.shp”); RtgRoutingSource routingSource = new RtgRoutingSource(@“C:\Users\HP\Desktop\test\HelloWorld\bin\Debug\shapefile\Roads.rtg”);
RoutingEngine routingEngine = new RoutingEngine(routingSource, featureSource);
it gives error
Error 1 The best overloaded method match for ‘ThinkGeo.MapSuite.Routing.RtgRoutingSource.GenerateRoutingData(string, ThinkGeo.MapSuite.Core.FeatureSource, ThinkGeo.MapSuite.Routing.BuildRoutingDataMode, ThinkGeo.MapSuite.Core.GeographyUnit, ThinkGeo.MapSuite.Core.DistanceUnit)’ has some invalid arguments C:\Users\HP\Desktop\test\HelloWorld\Form1.cs 53 13 HelloWorld
Error 2 Argument ‘1’: cannot convert from ‘ThinkGeo.MapSuite.Routing.RtgRoutingSource’ to ‘string’ C:\Users\HP\Desktop\test\HelloWorld\Form1.cs 53 50 HelloWorld
i have created .rtg file by independent build routing data module as described in sample data . but when i used that .rtg file for routing it gives error
The decimal degree longitude value you provided was out of range. Parameter name: fromLongitude