Пример #1
0
        static void EncodeDecodePointAlongLine(Coder coder, Coordinate coordinate)
        {
            // build point along line based on the closest line.
            var referencedPointAlongLine = coder.BuildPointAlongLine(coordinate);

            // encode.
            var encoded = coder.Encode(referencedPointAlongLine);

            // decode.
            var decodedReferencedLine = coder.Decode(encoded) as ReferencedPointAlongLine;
        }
Пример #2
0
        /// <summary>
        /// Encode/decode a point along line location.
        /// </summary>
        private static ReferencedPointAlongLine EncodeDecodePointAlongLine(Coder coder, float latitude, float longitude,
                                                                           out RouterPoint routerPoint)
        {
            var location        = coder.BuildPointAlongLine(latitude, longitude, out routerPoint);
            var locationGeoJson = location.ToFeatures(coder.Router.Db).ToGeoJson();

            var encoded = coder.Encode(location);

            var decoded        = coder.Decode(encoded) as ReferencedPointAlongLine;
            var decodedGeoJson = decoded.ToFeatures(coder.Router.Db).ToGeoJson();

            return(decoded);
        }