Exemplo n.º 1
0
 /// <summary>
 /// Create a RT90 position by converting a WGS84 position
 /// </summary>
 /// <param name="position">WGS84 position to convert</param>
 /// <param name="rt90projection">Projection to convert to</param>
 public SWEREF99Position(WGS84Position position, SWEREFProjection projection)
     : base(Grid.SWEREF99)
 {
     GaussKreuger gkProjection = new GaussKreuger();
     gkProjection.swedish_params(GetProjectionString(projection));
     var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude);
     Latitude = lat_lon[0];
     Longitude = lat_lon[1];
     Projection = projection;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create a RT90 position by converting a WGS84 position
 /// </summary>
 /// <param name="position">WGS84 position to convert</param>
 /// <param name="rt90projection">Projection to convert to</param>
 public RT90Position(WGS84Position position, RT90Projection rt90projection)
     : base(Grid.RT90)
 {
     GaussKreuger gkProjection = new GaussKreuger();
     gkProjection.swedish_params(GetProjectionString(rt90projection));
     var lat_lon = gkProjection.geodetic_to_grid(position.Latitude, position.Longitude);
     Latitude = lat_lon[0];
     Longitude = lat_lon[1];
     Projection = rt90projection;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Convert the position to WGS84 format
        /// </summary>
        /// <returns></returns>
        public WGS84Position ToWGS84()
        {
            GaussKreuger gkProjection = new GaussKreuger();
            gkProjection.swedish_params(ProjectionString);
            var lat_lon = gkProjection.grid_to_geodetic(Latitude, Longitude);

            WGS84Position newPos = new WGS84Position()
            {
                Latitude = lat_lon[0],
                Longitude = lat_lon[1],
                GridFormat = Grid.WGS84
            };

            return newPos;
        }
Exemplo n.º 4
0
        public void GetStopsByLocation(double latitude, double longitude, Action<IEnumerable<Model.Stop>> callback)
        {
            WGS84Position coordinates = new WGS84Position(latitude, longitude);
            RT90Position rtPos = new RT90Position(coordinates, RT90Position.RT90Projection.rt90_2_5_gon_v);

            FastWebClient client = new FastWebClient();

            client.DownloadStringCompleted += (s, e) => {
                string xml = e.Result;

                var stops = GetStops(xml);

                callback(stops);

            };

            if (NetworkInterface.GetIsNetworkAvailable()) {
                client.DownloadStringAsync(new Uri("http://vasttrafik.se/External_Services/TravelPlanner.asmx/GetStopListBasedOnCoordinate?identifier=ID&xCoord=" + rtPos.Latitude + "&yCoord=" + rtPos.Longitude));
            } else {
                callback(null);
            }
        }