geolocation

Getting street name from Address/Location object in Android

浪尽此生 提交于 2019-12-03 03:52:57
问题 I'm trying to get the street name of my current location but I can't seem to get it. I use this method to retrieve the Address: public Address getAddressForLocation(Context context, Location location) throws IOException { if (location == null) { return null; } double latitude = location.getLatitude(); double longitude = location.getLongitude(); int maxResults = 1; Geocoder gc = new Geocoder(context, Locale.getDefault()); List<Address> addresses = gc.getFromLocation(latitude, longitude,

Find closest city to given longitude/latitude [closed]

送分小仙女□ 提交于 2019-12-03 03:52:14
I have a set of 10 citys and want to find out which one is the closest to a given longitude/latitude. Any ideas how to do that using javascript? thx. rttmax From this site , you can use the Haversine formula: a = sin²(Δφ/2) + cos(φ1).cos(φ2).sin²(Δλ/2) c = 2.atan2(√a, √(1−a)) d = R.c Which can be implemented in Javascript: var R = 6371; // km var dLat = (lat2-lat1).toRad(); var dLon = (lon2-lon1).toRad(); var lat1 = lat1.toRad(); var lat2 = lat2.toRad(); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); var c = 2 * Math.atan2

Fastest way to find the location(zip, city, state) given latitude/longitude

那年仲夏 提交于 2019-12-03 03:38:01
I need a free(open-source) solution that given the lat/lng can return the closet city/state or zip. mysql is not an option, a small lightweight database would be the best if possible. Updates: No web services, with 50 million impressions a day even the smallest addon hurts so adding a service request would kill response time. I would prefer not to add more than 200 milliseconds on to the request. I have the database, lat/lon/zip/city/state in csv it's just how to store and more importantly how to retrieve it the quickest. Brute force: pre-load all of your data into an array. Calculate the

how to get satellite name or number when we are getting location through GPS in Android?

旧时模样 提交于 2019-12-03 03:30:41
I am new in android, I am getting location through gps, I am also getting satellite number in our code but I want to get specific satellite name or number which is used to get the location. I have google so much but not getting proper solution regarding this. My Question is:- 1. It is possible to get a particular satellite name or number ? if yes please help me how to find it ? Thanks in advance locationManager.getGpsStatus(null).getSatellites() (The caller may either pass in a GpsStatus object to set with the latest status information, or pass null to create a new GpsStatus object.) Returns

How to get Latitude and Longitude information from picture

六眼飞鱼酱① 提交于 2019-12-03 03:29:12
How to get latitude and longitude information from picture store in device or SD Card? Mohit Kanada I found very simple solution for this question....So I posted it here to help my friends who have problem like me to get Geo location from Picture. Bundle bundle = getIntent().getExtras(); if(null != bundle) { String filepath = bundle.getString(FILE_PATH_KEY); try { ExifInterface exif = new ExifInterface(filepath); StringBuilder builder = new StringBuilder(); builder.append("Date & Time: " + getExifTag(exif,ExifInterface.TAG_DATETIME) + "\n\n"); builder.append("Flash: " + getExifTag(exif

Google Geolocation API - Use longitude and latitude to get address in textbox?

a 夏天 提交于 2019-12-03 03:18:02
问题 I have noticed a lot of information about how to get your location using Google geolocation looks, based on IP address. But I am wondering if and how I could use this service to input a location (longitude and latitude) and get back the current address, or at least a city, state. I would like to do this in C#, but I'll work with any language. Any advice? 回答1: What you describe is called Reverse Geocoding. Google provides a Geocoding Web Service API which you can call from your server-side

Unit Testing Location Service

ぃ、小莉子 提交于 2019-12-03 03:16:54
I've got a location tracking service that I'm trying to unit test. I'm trying to use the locationManager.addTestProvider and setTestProviderLocation methods to achieve this. I can't seem to get any of the locations to pass through the provider and hit my LocationListener, however. Here is my code: public void testGettingLocations() { mLocationManager = (LocationManager)mContext.getSystemService(Context.LOCATION_SERVICE); if (mLocationManager.getProvider(TEST_PROVIDER) != null) { mLocationManager.removeTestProvider(TEST_PROVIDER); } mLocationManager.addTestProvider(TEST_PROVIDER, false, false,

Preventing annoying HTML5 geolocation alerts inside UIWebView

让人想犯罪 __ 提交于 2019-12-03 03:15:37
Whenever an script requests the geolocation using HTML5 's geolocation API, the UIWebView asks for a permission to use the iOS location services. This is pretty annoying, specially when you load static HTML files, it keeps asking the permission for each file, even if the user already granted this permission for the app itself. Is there a way to prevent it? I know that on safari the permission for geolocation is based on the domain and I agree on asking for permission when the request is done for a different domain, but shouldn't the UIWebView have the same geolocation permission as the app

Browser Awareness of Bluetooth Beacons / iBeacons

旧城冷巷雨未停 提交于 2019-12-03 03:13:40
Is there a way to make a browser aware of iBeacon devices in its proximity? Similar to the way HTML5 Geolocation is working... If not would this be something that can be achieved with a browser plug-in that can provide the detail to be consumed by javascript? Unfortunately, no. No web browsers have implemented any bridges between beacon detection and JavaScript. I don't think a plugin approach is possible on mobile browsers (either iOS or Android), because neither browser supports asynchronous communication between external apps and JavaScript in Mobile Safari / Mobile Chrome. The best you

ZIP / Postal Code + Country to Geo Coordinates

倖福魔咒の 提交于 2019-12-03 02:43:07
What is the most complete, precise and reliable way to get the coordinates (latitude / longitude) of a given ZIP / Postal Code of a given country? I need to make a lot of requests, so a high API limit rate (maybe even absent) would be useful. GeoNames dumps would be cool, but it seems to have way too many duplicate coordinates ( example ) and it also seems that their database is missing some ZIP / postal codes for specific countries. Are there any other (reliable) alternatives? While I was reading a Meta question , I came across this link: http://query.yahooapis.com/v1/public/yql?q=select%20