Ejemplo n.º 1
0
        public void WkbConvertMapPointToFromXYZM()
        {
            MapPoint mp = MapPoint.CreateWithM(12, 34, 56, 78);

            byte[] bytes = mp.ToWellKnownBinary();
            var    geom  = bytes.FromWellKnownBinary();

            Assert.IsNotNull(geom);
            Assert.IsInstanceOfType(geom, typeof(MapPoint));
            var mp2 = (MapPoint)geom;

            Assert.AreEqual(12, mp2.X);
            Assert.AreEqual(34, mp2.Y);
            Assert.AreEqual(56, mp2.Z);
            Assert.AreEqual(78, mp2.M);
        }
Ejemplo n.º 2
0
        public void WkbConvertMapPointToFromXYM()
        {
            MapPoint mp = MapPoint.CreateWithM(12, 34, 56, SpatialReferences.Wgs84);

            byte[] bytes = mp.ToWellKnownBinary();
            var    geom  = bytes.FromWellKnownBinary(mp.SpatialReference);

            Assert.IsNotNull(geom);
            Assert.AreEqual(SpatialReferences.Wgs84, geom.SpatialReference);
            Assert.IsInstanceOfType(geom, typeof(MapPoint));
            var mp2 = (MapPoint)geom;

            Assert.AreEqual(12, mp2.X);
            Assert.AreEqual(34, mp2.Y);
            Assert.IsFalse(mp2.HasZ);
            Assert.AreEqual(56, mp2.M);
        }
 public static MapPoint FromLatLong(double latitude, double longitude, double?elevation = null, double?measure = null)
 {
     if (!measure.HasValue)
     {
         if (!elevation.HasValue)
         {
             return(new MapPoint(longitude, latitude, SpatialReferences.Wgs84));
         }
         else
         {
             return(new MapPoint(longitude, latitude, elevation.Value, SpatialReferences.Wgs84));
         }
     }
     if (!elevation.HasValue)
     {
         return(MapPoint.CreateWithM(longitude, latitude, measure.Value, SpatialReferences.Wgs84));
     }
     else
     {
         return(MapPoint.CreateWithM(longitude, latitude, elevation.Value, measure.Value, SpatialReferences.Wgs84));
     }
 }