Hello,
I am using ThinkGeo Map and Google Map, features provided by map suit.
In both thinkgeo map and google map, to find the distance between two points, I am using your code mentioned below as you have given to me.
InMemoryFeatureLayer lineShapLayer = new InMemoryFeatureLayer();
//Adds the CustomDistanceLineStyle for displaying the distance in meter at mid point for each line segment.
CustomDistanceLineStyle customDistanceLineStyle = new CustomDistanceLineStyle(DistanceUnit.Kilometer, new GeoFont("Arial", 12, DrawingFontStyles.Bold),
new GeoSolidBrush(GeoColor.StandardColors.Black), new GeoPen(GeoColor.StandardColors.White));
lineShapLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(customDistanceLineStyle);
LineShape lineShape = new LineShape();
newLineShape = null;
newLineShape = lineShape;
//Adds a regular LineStyle for displaying in red the LineShape.
LineStyle lineStyle = new LineStyle(new GeoPen(GeoColor.FromArgb(150, GeoColor.StandardColors.Red), 5));
lineShapLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(lineStyle);
lineShapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay layerOverlay = new LayerOverlay("LineOverlay", false, TileType.SingleTile);
layerOverlay.TransitionEffect = TransitionEffect.None;
layerOverlay.Layers.Add(lineShapLayer);
DynamicOverlay.Layers.Add("lineShapeLayer", lineShapLayer);
Now, i have added one feature in my site that user can switch to google map from thinkgeo map and vice versa.
I am converting the data of lineShapeLayer - InternalMemoryFeature when user click on google map using projection of google map. Which code is given below:
Proj4Projection prj4 = new Proj4Projection();
prj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
prj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
if (!prj4.IsOpen)
prj4.Open();
for (int i = 0; i < lineShapeLayer.InternalFeatures.Count; i++)
{
lineShapeLayer.InternalFeatures = prj4.ConvertToExternalProjection(lineShapeLayer.InternalFeatures);
}
When I switched from Google Map to Think Geo map, I make the mapunit to GeographyUnit.DecimalDegree and switched to Google Map, make mapunit to GeographyUnit.Meter.
But problem is, when I measured the distance between two points in Thinkgeo map, the measurement value is changed when I switch to google map. In thinkgeo map, I got 0.82 km in thinkgeo while got 0.91km in Google map. Both images I have attached for your reference.
ThinkGeo Map Image:
Google Map Image:
Why does it do so? What should I do for it?
Thanks,
Badal Patel
Thinkgeo.png (47.5 KB)
google.jpg (83.3 KB)