Follow

Navigate to address example

Introduction

This sample show how to start navigation to an input address.
The address is first translated to GPS coordinates by the API geocoding function LocationFromAddress and subsequently the navigation is started through StartNavigation.

C#

        NavigateToAddress("SVK,Bratislava,Einsteinova,18");

        void NavigateToAddress(string strAddress)
        {
            SError err;
            bool bPostal = false;
            bool bValueMatch = true;
            int maxTime = 0;

            int flags = 0;
            bool bShowApplication = true;
            bool bSearchAddress = true;
            SWayPoint wp = new SWayPoint();

            LONGPOSITION location;
            int ret = CApplicationAPI.LocationFromAddress(out err, out location, strAddress, bPostal, bValueMatch, maxTime);
            if (ret == 1)
            {
                string tmpAddress;
                CApplicationAPI.GetLocationInfo(out err, location, out tmpAddress, maxTime);
                Debug.WriteLine("x=" + location.lX.ToString() + ", y=" + location.lY.ToString() + ", address:" + tmpAddress);
            }
            wp.Location.lX = location.lX;
            wp.Location.lY = location.lY;
            CApplicationAPI.StartNavigation(out err, ref wp, flags, bShowApplication, bSearchAddress, maxTime);
        }

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments