Change projection

5 posts, 0 answers
  1. Ioan
    Ioan avatar
    34 posts
    Member since:
    Dec 2012

    Posted 04 Nov 2014 Link to this post

    I made a custom map provider for Yandex maps, but it seems Yandex is using projection.wgs84Mercator.
    Pins on Bing and OpenStreet maps are positioned correctly but those on yandex are offseted.
    Does RadMap support Yandex's projection?
  2. Ioan
    Ioan avatar
    34 posts
    Member since:
    Dec 2012

    Posted 05 Nov 2014 in reply to Ioan Link to this post

    It seems RadMap doesn't support yandex projection projection.wgs84Mercator (EPSG:4326 ellipsoid). Can you please provide a starting point for creating my own projection?
  3. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2971 posts

    Posted 07 Nov 2014 Link to this post

    Hello Loan,

    You can create custom map provider and override its SpatialRefence property which returns the projection.
    public class MyMapProvider : TiledProvider
    {
           /// <summary>
           /// Initializes a new instance of the MyMapProvider class.
           /// </summary>
           public MyMapProvider()
                 : base()
           {
                 MyMapSource source = new MyMapSource();
                 this.MapSources.Add(source.UniqueId, source);
           }
           /// <summary>
           /// Returns the SpatialReference for the map provider.
           /// </summary>
           public override ISpatialReference SpatialReference
           {
                 get
                 {
                        return new MercatorProjection();
                 }

    We hope you can also find useful the following threads:

    Custom Map Projection
    Offline map Servier ( Andrey's post from 26. October 2011 )
     
    Regards,
    Petar Mladenov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  4. Massimo
    Massimo avatar
    23 posts
    Member since:
    Apr 2013

    Posted 26 Feb in reply to Petar Mladenov Link to this post

    Hi loan, have you succeeded?

    Can telerik provide a little help to implement GeographicToLogical and LogicalToGeographic functions please?

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2971 posts

    Posted 01 Mar Link to this post

    Hi Massimo,

    Have you tried implementing custom projection by inheriting from our SpatialReference class. Basically it implements the mentioned GographicToLocigal and LogicalToGeographic functions:

    /// <summary>
        /// The OGC Spatial Reference requirements.
        /// </summary>
        public class SpatialReference : ISpatialReference
    ....
     
     /// <summary>
            /// Converts a geographical coordinate (Longitude, Latitude) to a logical Point (0->1).
            /// </summary>
            /// <param name="geographicPoint">The geographical coordinate (Longitude, Latitude).</param>
            /// <returns>The logical Point.</returns>
            public virtual Point GeographicToLogical(Location geographicPoint)
            {
                double d = Math.Sin(geographicPoint.Latitude * this.AngularUnitOfMeasurement);
     
                Point point = new Point((geographicPoint.Longitude * this.AngularUnitOfMeasurement * this.ScaleX) + this.OffsetX,
                    (0.5 * Math.Log((1.0 + d) / (1.0 - d)) * this.ScaleY) + this.OffsetY);
     
                if (point.Y > 1)
                {
                    point.Y = 1;
                }
     
                return point;
            }
     
            /// <summary>
            /// Converts a logical Point (0->1) to a geographical coordinate (Longitude, Latitude).
            /// </summary>
            /// <param name="logicalPoint">The logical Point.</param>
            /// <returns>The geographical coordinate (Longitude, Latitude).</returns>
            public virtual Location LogicalToGeographic(Point logicalPoint)
            {
                return new Location(
                    Math.Atan(Math.Sinh((logicalPoint.Y - this.OffsetY) / this.ScaleY)) * RadiansToDegrees,
                    (logicalPoint.X - this.OffsetX) * RadiansToDegrees / this.ScaleX);
            }


    Regards,
    Petar Mladenov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top