I want to show route and a moving car in the defined route. I am using Google Map and MapUnit in meter. I have seen the sample in HowDoISamples -> EfficientlyMoveAPlane. It is properly working with MapUnit in DecimalDegree but not in Meter.How can I do in Meter.
Yes, as you already seen, this HowDoI samples only shows the GreatCirle used in DecimalDegrees, I am not sure we can achieve the same effects in other projections, I will ask for help from one of our GIS specialist. It seems we can achieve this, take a look the final result of the snapping shot: code.thinkgeo.com/projects/show/greatcirclepacific
I forgot to say that the sample is developed in Web Edition, the code should be very similar if a desktop edition version is wanted. Any more questions just feel free to let me know.
//Gets the Great Circle in decimal degrees. MultilineShape greatCircleMultiLineShape = pointShape1.GetShortestLineTo(pointShape2, GeographyUnit.DecimalDegree);
//Builds the MultilineShape in the Google Map projection. MultilineShape resultGreatMultiLineShape = new MultilineShape(); foreach (LineShape lineShape in greatCircleMultiLineShape.Lines) { //For the western hemisphere, simply converts to Google Map projection if (lineShape.Vertices[0].X < 0) { LineShape resultLineShape = new LineShape(); foreach (Vertex vertex in lineShape.Vertices) { Vertex projVertex = proj4.ConvertToExternalProjection(vertex.X, vertex.Y); resultLineShape.Vertices.Add(projVertex); } resultGreatMultiLineShape.Lines.Add(resultLineShape); } //For the eastern hemisphere, converts to Google Map projection and offsets. else { LineShape resultLineShape = new LineShape(); foreach (Vertex vertex in lineShape.Vertices) { Vertex projVertex = proj4.ConvertToExternalProjection(vertex.X, vertex.Y); resultLineShape.Vertices.Add(projVertex); } resultGreatMultiLineShape.Lines.Add(resultLineShape); } }
In the code given by you, if the start position of multishape line is origin (0,0) then only it works properly. If start point is not origin then the line ploted do not passes through the given points.
I am exactly using the same code given by Yale above. And it works properly only if one of the location is set to (0,0) and if I donot set any of the location to 0 then the multiline ploted donot passes through the set end points.
Can you let me know if you do not set the lat/long to 0, then what values are you trying to use? And it would be great if you could get a screenshot out to show us the problem, that would be much more clear.
You have to understand that the function GetGreatCircle in the Code Community project is for placing the great circle over the Pacific Rim when the Great Circle actually crosses the 180 degree meridian. In the example, you are giving the Great Circle does not crosses the 180 degree meridian. I modified the GetGreatCircle function so that it takes into account all the scenarios and you have the choice to offset the Great Circle either to the West or to the East. I think that with the attached screen shots you will better understand what is going on. Keep in mind that with that new GetGreatCircle if the Great Circle does not cross the 180 degree meridian no offset is applied.
//Gets the Great Circle in decimal degrees. MultilineShape greatCircleMultiLineShape = pointShape1.GetShortestLineTo(pointShape2, GeographyUnit.DecimalDegree);
//Builds the MultilineShape in the Google Map projection. MultilineShape resultGreatMultiLineShape = new MultilineShape();
I am able to plot a ShortestLine between two defined vertex instead of GreatCircle. By using the line given below
greatCircleMultiLineShape As MultilineShape = pointShape1.GetShortestLineTo(pointShape2, GeographyUnit.Meter)
Dim
Now I want to show an object moving on the line drawn according to Timer. But I am getting only two vertex of the line i.e Start and End Point of the line. So I am not able to move a Point on the line drawn. As which was working with GreatCircle with GeographicUnit as DecimalDegree. So please help me to do it in Meter as Geographic Unit.