Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Write a method in your BI that gives you all the restaurants between the bounds of the Map (or within a given distance from the center (LatLon) of the Map. I used to do it embedding a custom function in Sqlite </p> <pre><code>[SqliteFunctionAttribute(Name = "distance", Arguments = 4, FuncType = FunctionType.Scalar)] class SqliteDistance : SqliteFunction { public override object Invoke(object[] args) { double latA = System.Convert.ToDouble(args[0]); double lonA = System.Convert.ToDouble(args[1]); double latB = System.Convert.ToDouble(args[2]); double lonB = System.Convert.ToDouble(args[3]); const double R = 6371; const double pigreco = 3.1415927; double lat_alfa, lat_beta; double lon_alfa, lon_beta; double fi; double p, d; /* Converte i gradi in radianti */ lat_alfa = pigreco * latA / 180; lat_beta = pigreco * latB / 180; lon_alfa = pigreco * lonA / 180; lon_beta = pigreco * lonB / 180; /* Calcola l'angolo compreso fi */ fi = Math.Abs(lon_alfa - lon_beta); /* Calcola il terzo lato del triangolo sferico */ p = Math.Acos(Math.Sin(lat_beta) * Math.Sin(lat_alfa) + Math.Cos(lat_beta) * Math.Cos(lat_alfa) * Math.Cos(fi)); /* Calcola la distanza sulla superficie terrestre R = ~6371 km */ d = p * R; return (d); } } </code></pre> <p>then in your query :</p> <pre><code>Public List&lt;Restaurant&gt; GiveMeRestaurants(double fromLat, double fromLon) { String sql="Select * from restaurants where distance('" + fromLat.ToString() + "','" + fromLon.ToString() + "',restaurants.Latitude,restaurants.Longitude) &lt;= 100 )"; } </code></pre> <p>This can give you also the straight line distance.</p> <ol> <li>For road distance maybe you can call google play services using the center map and the coordinates or the restaurant</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload