public void MainTest()
        {
            var    clarke  = IRI.Ham.CoordinateSystem.Ellipsoids.Clarke1880Rgs;
            double phi0    = 32.5;
            double phi1    = 29.65508274166;
            double phi2    = 35.31468809166;
            double lambda0 = 45.0;
            var    niocLcc = new LambertConformalConic(clarke, phi1, phi2, lambda0, phi0, 1500000.0, 1166200.0, 0.9987864078);

            var xLccNioc = 2047473.33479;
            var yLccNioc = 912594.777238;

            var xWgs84 = 50.689721;
            var yWgs84 = 30.072906;

            var xWebMercator = 5642753.9243;
            var yWebMercator = 3512924.70491;

            var xClarke1880Rgs = 50.689721;
            var yClarke1880Rgs = 30.075637;


            var wgs84 = niocLcc.ToWgs84Geodetic(new Point(xLccNioc, yLccNioc));

            Assert.AreEqual(xWgs84, wgs84.X, 1E-6);
            Assert.AreEqual(yWgs84, wgs84.Y, 1E-6);

            var clarke1880 = niocLcc.ToGeodetic(new Point(xLccNioc, yLccNioc));

            Assert.AreEqual(xClarke1880Rgs, clarke1880.X, 1E-6);
            Assert.AreEqual(yClarke1880Rgs, clarke1880.Y, 1E-6);

            var webMercator = MapProjects.GeodeticWgs84ToWebMercator(wgs84);

            Assert.AreEqual(xWebMercator, webMercator.X, 0.05);
            Assert.AreEqual(yWebMercator, webMercator.Y, 0.05);

            var clarke1880_2 = Transformation.ChangeDatum(wgs84, Ellipsoids.WGS84, Ellipsoids.Clarke1880Rgs);

            Assert.AreEqual(xClarke1880Rgs, clarke1880_2.X, 1E-6);
            Assert.AreEqual(yClarke1880Rgs, clarke1880_2.Y, 1E-6);
        }
Exemple #2
0
        public GeoTaggedImage(string imageFileName)
        {
            try
            {
                this.ImageFileName = imageFileName;

                var location = System.IO.Path.ChangeExtension(imageFileName, ".corx");

                if (System.IO.File.Exists(location))
                {
                    this.GeographicLocation = JsonConvert.DeserializeObject <Point3D>(System.IO.File.ReadAllText(location));

                    var webMercator = MapProjects.GeodeticWgs84ToWebMercator((Point)GeographicLocation);

                    this.MercatorLocation = new Point3D(webMercator.X, webMercator.Y, GeographicLocation.Z);
                }
                else
                {
                    using (var bitmap = new System.Drawing.Bitmap(imageFileName))
                    {
                        this.GeographicLocation = Helpers.ImageHelper.GetWgs84Location(bitmap);

                        var webMercator = MapProjects.GeodeticWgs84ToWebMercator((Point)GeographicLocation);

                        this.MercatorLocation = new Point3D(webMercator.X, webMercator.Y, GeographicLocation.Z);

                        System.IO.File.WriteAllText(location, JsonConvert.SerializeObject(this.GeographicLocation));
                    }
                }
            }
            catch (Exception)
            {
                this.GeographicLocation = Point3D.NaN;

                this.MercatorLocation = Point3D.NaN;
            }
        }
Exemple #3
0
        public static GoToPresenter Create(MapPresenter mapPresenter)
        {
            var gotoPresenter = new GoToPresenter(
                p =>
            {
                var webMercatorPoint = MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.PanTo(webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            },
                p =>
            {
                var webMercatorPoint = IRI.Ham.CoordinateSystem.MapProjection.MapProjects.GeodeticWgs84ToWebMercator(p);

                mapPresenter.ZoomToLevelAndCenter(13, webMercatorPoint, () =>
                {
                    mapPresenter.FlashPoint(webMercatorPoint);
                });
            });

            return(gotoPresenter);
        }
Exemple #4
0
 public override IPoint FromGeodetic(IPoint geodeticWgs84)
 {
     return(MapProjects.GeodeticWgs84ToWebMercator(geodeticWgs84));
 }
Exemple #5
0
 public static SqlGeometry GeodeticWgs84ToWebMercator(this SqlGeography geometry)
 {
     return(Project(geometry, point => MapProjects.GeodeticWgs84ToWebMercator(point), SridHelper.WebMercator));
 }