geolocation

PHP MySql and geolocation

一笑奈何 提交于 2019-11-26 19:50:55
问题 I am writing a site that basically looks for places within a 25 mile radius of a lat and long using php and mysql. I am wondering how something like this would work? I would pass a lat and long to the scrip and have it pull out only locations that are within 25 miles of the lat and long from my Database of locations. What is the best way to do this? EDIT: I found this code for calculating the distance between 2 points. function distance($lat1, $lon1, $lat2, $lon2, $unit) { $theta = $lon1 -

How to Sort Geo-points according to the distance from current location in Android

萝らか妹 提交于 2019-11-26 19:47:30
问题 I have a "Place" object with a LatLng coordinate for each: import com.google.android.gms.maps.model.LatLng; public class Place{ public String name; public LatLng latlng; public Restaurant(String name, LatLng latlng) { this.name = name; this.latlng = latlng; } } and I have an ArrayList of these Places, something like this: ArrayList<Place> places = new ArrayList<Place>(); places.add("Place 1", LatLng(90.0,90.0)); places.add("Place 2", LatLng(93.0,93.0)); places.add("Place 3", LatLng(83.0,92.0)

Return distance in elasticsearch results?

我的未来我决定 提交于 2019-11-26 19:42:38
问题 My question is similar to this one. Simply, is there a way to return the geo distance when NOT sorting with _geo_distance? Update: To clarify, I want the results in random order AND include distance. 回答1: Yes you can, by using a script field. For instance, assuming your doc have a geo-point field called location , you could use the following: (note the \u0027 is just an escaped single quote, so \u0027location\u0027 is really 'location' ) curl -XGET 'http://127.0.0.1:9200/geonames/_search

Android: How to get location information from intent bundle extras when using LocationManager.requestLocationUpdates()

安稳与你 提交于 2019-11-26 19:36:46
问题 I am trying to use Android's LocationManager requestLocationUpdates. Everything is working until I try to extract the actual location object that in my broadcast receiver. Do I need to specifically define the "extras" to my custom intent so that the Android LocationManager before I pass it to requestLocationUpdates so it knows how to add it into the intent, or will it create the extras-bundle regardless when it passes the fired intent to the broadcast receiver? My code looks like this: Intent

How to continuously track the location of an Android mobile phone?

佐手、 提交于 2019-11-26 19:26:05
问题 I need to write an app, which every 5 minutes determines the current location of the mobile phone (using all free, available location providers) and sends it to a server. If some location provider doesn't work at the start of the application, but becomes available later, the application should process its location data as well. In order to do this, I implemented following class. In one of my activities, I create an instance of it and call its startTrackingUpdates method. locationChangeHandler

Get the distance between two geo points

北慕城南 提交于 2019-11-26 19:19:24
I want to make an app which checks the nearest place where a user is. I can easily get the location of the user and I have already a list of places with latitude and longitude. What would be the best way to know the nearest place of the list against the current user location. I could not find anything in the google APIs. Location loc1 = new Location(""); loc1.setLatitude(lat1); loc1.setLongitude(lon1); Location loc2 = new Location(""); loc2.setLatitude(lat2); loc2.setLongitude(lon2); float distanceInMeters = loc1.distanceTo(loc2); Reference: http://developer.android.com/reference/android

Android : LocationManager vs Google Play Services

允我心安 提交于 2019-11-26 19:15:37
I want to build an app that centers around getting the user's current location and then find points of interest(such as bars,restaurants,etc) that are close to him/her via the Google Places API . Upon searching the web for a place to start I came across some tutorials that use the LocationManager class and some others that use Google Play Services in order to find the users location. On first sight both of them do the same thing, but since I am new to this I got a little confused and I don't know which method suits my needs the best. So, I want to ask you : What are the differences between

How does HTML5 Geolocation Work?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 18:58:14
问题 Chrome and Firefox have HTML Geolocation implemented. My question is: how does it work? Do they have a Database locally and get the information from the provider then try to match it? Where is the DB stored ? Can it be accessed ? Update1: the only downside to geolocation is the browser has to ask the user for permission and this is really a bad thing for usability. I understand the security issue but still I don't see how this will become a popular solution. Update2 : Firefox is using a

SQL Query for Performing Radius Search based on Latitude Longitude

别说谁变了你拦得住时间么 提交于 2019-11-26 18:57:13
问题 We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have the following query for this purpose: ***Parameters*** Longitude: -74.008680 Latitude: 40.711676 Radius: 1 mile ***Query*** SELECT * FROM restaurant WHERE ( POW( ( 69.1 * ( Longitude - -74.008680 ) * cos( 40.711676 / 57.3 ) ) , 2 ) + POW( ( 69.1 * ( Latitude - 40.711676 ) ) , 2 ) ) < ( 1 *1 ); The

Querying within longitude and latitude in MySQL

大兔子大兔子 提交于 2019-11-26 18:49:44
问题 Before asking for specific code examples, I just wanted to ask whether it is possible to make a query something like this pseudo code: select items from table where lat/lon = -within x miles of a certain lat/lon point- Is that doable? Or do I have to jump through some hoops? Any good approaches that could be recommended would be great! 回答1: You should search for the Haversine formula, but a good start could be: Creating a Store Locator with PHP, MySQL & Google Maps - See Section 'Finding