Follow

Find Nearby POI example

Introduction

This example demonstrates how to find the nearest petrol station around a given location (Karadzicova, Bratislava, Slovakia) and start navigating to it.

C#

        NavigateToNearestPetrolStation(4809159, 1714193);

        void NavigateToNearestPetrolStation(int lat, int lon)  // coordinates multiplied by 100 000
        {
            SError err;
            SPoi poi = new SPoi();
            int categoryID = (int)PoiService.Petrol_Station;
            string strCategoryName = null;
            int maxTime = 0;
            int flags = 0;

            bool bShowApplication = true;
            bool bSearchAddress = false;
            SWayPoint wp = new SWayPoint();

            int ret = CApplicationAPI.FindNearbyPoi(out err, out poi, categoryID, strCategoryName, lon, lat, maxTime);

            wp.Location.lX = poi.Location.lX;
            wp.Location.lY = poi.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