This is a migrated thread and some comments may be shown as answers.

Change projection

4 Answers 29 Views
Map
This is a migrated thread and some comments may be shown as answers.
Ioan
Top achievements
Rank 1
Ioan asked on 04 Nov 2014, 07:27 PM
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?

4 Answers, 1 is accepted

Sort by
0
Ioan
Top achievements
Rank 1
answered on 05 Nov 2014, 07:47 AM
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?
0
Petar Mladenov
Telerik team
answered on 07 Nov 2014, 08:28 AM
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.

 
0
Massimo
Top achievements
Rank 1
answered on 26 Feb 2017, 02:17 PM

Hi loan, have you succeeded?

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

0
Petar Mladenov
Telerik team
answered on 01 Mar 2017, 09:14 AM
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.
Tags
Map
Asked by
Ioan
Top achievements
Rank 1
Answers by
Ioan
Top achievements
Rank 1
Petar Mladenov
Telerik team
Massimo
Top achievements
Rank 1
Share this question
or