Hi Don,
With Out Projection means epsg 4326.
I adjusted the code(missed result point into projection). Now, GetClosestPointTo mehtod working fine.
But one more thing, I want to check result point intersects line or not. it’s coming false.
Note : I am using 9.0.0.0 version.
Please check bellow code.
ManagedProj4Projection proj = new ManagedProj4Projection();
proj.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
proj.ExternalProjectionParametersString = Proj4Projection.GetEsriParametersString(54004);
InMemoryFeatureLayer imftl = new InMemoryFeatureLayer();
//imftl.FeatureSource.Projection = proj;
imftl.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Cross, new GeoSolidBrush(GeoColors.Red), 10);
imftl.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColors.Blue, 1));
imftl.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay lo = new LayerOverlay();
lo.Layers.Add("Layer", imftl);
wfMap.Overlays.Add("RoutesOverlay", lo);
LineShape ln = new LineShape("LINESTRING(10 10,20 20)");
Feature ftLn = new Feature(ln);
imftl.InternalFeatures.Add(proj.ConvertToExternalProjection(ftLn));
PointShape pt1 = new PointShape("POINT(16 16)");
Feature ftPt1 = new Feature(pt1);
PointShape pt2 = proj.ConvertToExternalProjection(ln).GetClosestPointTo(proj.ConvertToExternalProjection(pt1), wfMap.MapUnit);
Feature ftPt2 = new Feature(pt2);
imftl.InternalFeatures.Add(ftPt2);
//bool isIntersects = proj.ConvertToInternalProjection(pt2).Intersects(ln);
//bool isIntersects = pt2.Intersects(proj.ConvertToExternalProjection(ln));
bool isIntersects = ftPt2.Intersects(proj.ConvertToExternalProjection(ftLn));
if (isIntersects)
MessageBox.Show("Intersects");
else
MessageBox.Show("Not Intersects");
suggest me to solve this issue?
Thanks,
Riyaz