ThinkGeo.com    |     Documentation    |     Premium Support

Exception "Currently DecimalDegree are not supported." when perform NearestTo feature search

Guys,


My map unit is set to DecimalDegree.  When I perform a feature search using QueryTools.GetFeaturesNearestTo() I get the following exception if this layer contains lines and polygon shapes.  Why so and how do I prevent the error?  Is there perhaps a property on the FeatureLayer I can check before performing the query?  TIA,



Type : System.NotSupportedException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


Message : Currently DecimalDegree are not supported.


Source : MapSuiteCore


Help link : 


Data : System.Collections.ListDictionaryInternal


TargetSite : Double GetDistanceToCore(ThinkGeo.MapSuite.Core.BaseShape, ThinkGeo.MapSuite.Core.GeographyUnit, ThinkGeo.MapSuite.Core.DistanceUnit)


Stack Trace :    at ThinkGeo.MapSuite.Core.BaseShape.GetDistanceToCore(BaseShape targetShape, GeographyUnit shapeUnit, DistanceUnit distanceUnit)


   at ThinkGeo.MapSuite.Core.BaseShape.GetDistanceTo(BaseShape targetShape, GeographyUnit shapeUnit, DistanceUnit distanceUnit)


   at ThinkGeo.MapSuite.Core.FeatureSource.x578ba6bc9b40dde3(Collection`1 x12bd8932482887e7, BaseShape xb513c0b05488b8ed, GeographyUnit x13ff1d8096fd433a, Int32 xf7fd4571e5a40328)


   at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesNearestToCore(BaseShape targetShape, GeographyUnit unitOfData, Int32 numberOfItemsToFind, IEnumerable`1 returningColumnNames)


   at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesNearestTo(BaseShape targetShape, GeographyUnit unitOfFeatureSource, Int32 numberOfItemsToFind, IEnumerable`1 returningColumnNames)


   at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesNearestTo(BaseShape targetShape, GeographyUnit unitOfFeatureSource, Int32 numberOfItemsToFind, ReturningColumnsType returningColumnNamesType)


   at ThinkGeo.MapSuite.Core.QueryTools.GetFeaturesNearestTo(BaseShape targetShape, GeographyUnit unitOfData, Int32 numberOfItemsToFind, ReturningColumnsType returningColumnNamesType)


   at EMS.ThinkGeoLibrary.MapSuite.Utilities.FeatureFinderHelper.QueryFeatures(BaseShape shape, FeatureLayer layer, IEnumerable`1 columnnNames, GeographyUnit gUnit, DistanceUnit dUnit, SpatialOperationType ops, Int32 numberOfFeaturesToReturn) in C:\dev\LUT600 2.1.1\OCC600\Source\GIS\Modules\ThinkGeo\ThinkGeoLibrary\Utilities\FeatureFinderHelper.cs:line 342




Klaus,


I have tested GetDistanceTo method with many data to try to recreate your problem but with on luck, so could you provide the problem data to us? You can get the suspect feature and targetshape as WellKnownText by following code:
            featureLayer.Open();
            Collection<Feature> features = featureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.NoColumns);
            featureLayer.Close();
            foreach (Feature feature in features)
            {
                BaseShape shape = feature.GetShape();
                try
                {
                    shape.GetDistanceTo(targetshape, GeographyUnit.DecimalDegree, DistanceUnit.Meter);
                }
                catch
                {
                    string shapeWkt = shape.GetWellKnownText();
                    string targetShapeWkt = targetshape.GetWellKnownText();
                }
            }

Thanks,
James