コード例 #1
0
        public void TestAuthorityCodeParsing()
        {
            const string      wkt1 = "PROJCS[\"NAD_1983_BC_Environment_Albers\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Albers\"],PARAMETER[\"False_Easting\",1000000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-126.0],PARAMETER[\"Standard_Parallel_1\",50.0],PARAMETER[\"Standard_Parallel_2\",58.5],PARAMETER[\"Latitude_Of_Origin\",45.0],UNIT[\"Meter\",1.0],AUTHORITY[\"EPSG\",\"3005\"]]";
            ICoordinateSystem cs1 = null, cs2 = null;

            Assert.DoesNotThrow(() => cs1 = CoordinateSystemFactory.CreateFromWkt(wkt1));
            Assert.IsNotNull(cs1);
            const string wkt2 = "PROJCS[\"NAD_1983_BC_Environment_Albers\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Albers\"],PARAMETER[\"False_Easting\",1000000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",-126.0],PARAMETER[\"Standard_Parallel_1\",50.0],PARAMETER[\"Standard_Parallel_2\",58.5],PARAMETER[\"Latitude_Of_Origin\",45.0],UNIT[\"Meter\",1.0],AUTHORITY[\"EPSG\",3005]]";

            Assert.DoesNotThrow(() => cs2 = CoordinateSystemFactory.CreateFromWkt(wkt2));
            Assert.IsNotNull(cs2);
            //Assert.AreEqual(cs1, cs2);
            Assert.IsTrue(cs1.EqualParams(cs2));
        }
コード例 #2
0
        private FeatureQueryExpression transformQuery(FeatureQueryExpression query)
        {
            SpatialBinaryExpression spatial = query.SpatialPredicate;
            ICoordinateSystem       querySpatialReference = spatial.SpatialExpression.SpatialReference;

            if (querySpatialReference.EqualParams(OriginalSpatialReference))
            {
                return(query);
            }

            //if (querySpatialReference != OriginalSpatialReference)
            //{
            //    throw new InvalidOperationException("The query's spatial reference doesn't match the provider's.");
            //}

            GeometryExpression geoExpression = spatial.SpatialExpression as GeometryExpression;

            if (geoExpression != null)
            {
                IGeometry transformed = CoordinateTransformation.InverseTransform(geoExpression.Geometry,
                                                                                  GeometryFactory);
                geoExpression = new GeometryExpression(transformed);
                spatial       = spatial.IsSpatialExpressionLeft
                              ? new SpatialBinaryExpression(geoExpression, spatial.Op, spatial.Expression)
                              : new SpatialBinaryExpression(spatial.Expression, spatial.Op, geoExpression);
            }
            else
            {
                IExtents transformed = CoordinateTransformation.InverseTransform(spatial.SpatialExpression.Extents,
                                                                                 GeometryFactory);
                ExtentsExpression extentsExpression = new ExtentsExpression(transformed);
                spatial = spatial.IsSpatialExpressionLeft
                              ? new SpatialBinaryExpression(extentsExpression, spatial.Op, spatial.Expression)
                              : new SpatialBinaryExpression(spatial.Expression, spatial.Op, extentsExpression);
            }

            query = new FeatureQueryExpression(query, spatial);
            return(query);
        }
コード例 #3
0
 public bool EqualParams(object obj)
 {
     return(_coordinateSystem.EqualParams(obj));
 }