geolocation

get map latitude longitude from mouse position

被刻印的时光 ゝ 提交于 2019-11-30 12:57:14
问题 I am trying to convert the position of the mouse on a google map into a LatLng object. I see quite a few posts on getting the position from with the google map "click" event etc, like this: google.maps.event.addListener(map, 'click', function(event) { mouseLocation = event.latLng; }); But, this doesn't work for my purposes because I am not responding to a map event, I'm responding to a 'tapHold' event. Inside the tapHold event I'd like to get the latitude and longitude of the current mouse

Geographical coordinates to street names

最后都变了- 提交于 2019-11-30 12:33:51
问题 is any way (with a rest API will be awesome) to get the Street name corresponding to a Geographical coordinate? I think the name is geocoding, do google have this API? Im PHP developer. Ex. <?php cor="38.115583,13.37579"; echo(geoname(cor)); // this prints: Foro Umberto I - 90133 Palermo ?> So the output of the function is the street name, the postal code and the city. Thanks for any help and scripts examples! 回答1: Yes, just use the "Reverse Geocoding" function in the Google Maps API: http:/

Geolocation: moving only google maps marker without reload the map

耗尽温柔 提交于 2019-11-30 12:20:43
问题 I need to update only the marker when the device is moving or when the device is getting more accuracy. When the position change also reload the map and I need to move only the maker. I have the following code: if (navigator.geolocation) { navigator.geolocation.watchPosition( function(position){ var latitude = position.coords.latitude; var longitude = position.coords.longitude; var accuracy = position.coords.accuracy; var coords = new google.maps.LatLng(latitude, longitude); var mapOptions =

Android webview geoposition database failed to open

时光怂恿深爱的人放手 提交于 2019-11-30 12:19:44
I have website using javascript geolocation api and want it to open in a webview. I set up these permissions in the manifest file: <uses-permission android:name="android.permission.ACCESS_GPS" /> <uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /> <uses-permission android:name="android.permission.ACCESS_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> In my activity, I also set webview settings: webview.getSettings().setDatabaseEnabled(true); webview

How to fake return calls from the geolocator in jasmine

流过昼夜 提交于 2019-11-30 12:17:28
I have a function that calls the geolocator and i don't know how to test this function. I've tried spying on the geolocator and returning fake data but with no success, the original function is still used and so i would have to wait and i couldn't use mock data. // this doesn't work var navigator_spy = spyOn( navigator.geolocation, 'getCurrentPosition' ).andReturn( { coords : { latitude : 63, longitude : 143 } } ); How can I do this? When you call the geolocation code, it looks like this: navigator.geolocation.getCurrentPosition(onSuccess, onError); This means that you're calling it and

Finding Location : Google Play Location Service or Android platform location APIs

霸气de小男生 提交于 2019-11-30 11:11:14
问题 i am trying to get the users location for my new navigation app. i want to check the users location frequently and it has to be accurate . I use the following code from sample to get the location . public class MainActivity extends Activity implements LocationListener { private LocationManager locationManager; private String provider; private TextView a; private TextView b; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

navigator.geolocation.getCurrentPosition doesn't work on android google chrome

时间秒杀一切 提交于 2019-11-30 10:48:56
This code: navigator.geolocation.getCurrentPosition( function(position) { alert(position.coords.latitude, position.coords.longitude); }, function(error){ alert(error.message); }, { enableHighAccuracy: true ,timeout : 5000 } ); https://jsfiddle.net/FcRpM/ works in Google Chrome at my laptop, but on mobile HTC one S (android 4.1, GPS off, location via mobile networks and wifi enabled), connected to internet via WiFi. Default browser works fine. Google Chrome, Opera, Yandex.browser for android fails with "Timeout expired". other android apps locates me correct. You can try this. It seems to work

How to get the nearest area from a list of locations?

笑着哭i 提交于 2019-11-30 10:39:34
I have a API which returns a list of different areas within a city with the weather at that area. I want to get the nearest area based on my current location. API returns Area Latitude Longitude Weather How to find the nearest area based on this data? You would have to create CLLocation objects for all the areas, plus one for the current location of the user. Then use a loop similar to the one below to get the closest location: NSArray *allLocations; // this array contains all CLLocation objects for the locations from the API you use CLLocation *currentUserLocation; CLLocation *closestLocation

Smart way to get the public Internet IP address/geo loc

六月ゝ 毕业季﹏ 提交于 2019-11-30 10:28:20
I have a computer on the local network, behind a NAT router. I have some 192.168.0.x addresses, but I really want to know my public IP address, not something mentioned in How to get the IP address of the server on which my C# application is running on? or How to get the IP address of a machine in C# I need C# code. Is it possible? If so, how? Jim Mischel I prefer http://icanhazip.com . It returns a simple text string. No HTML parsing required. string myIp = new WebClient().DownloadString(@"http://icanhazip.com").Trim(); After some search, and by expanding my requirements, I found out that this

Ordering Firestore GeoHash query from closest to furthest?

情到浓时终转凉″ 提交于 2019-11-30 09:52:38
问题 Currently, I'm using parts of the GeoFirebase library along with Firestore to allow for geoquerying. When I set the geohash of a post, I do it as such if let geoHash = GFGeoHash(location: location.coordinate).geoHashValue { However, to make the geohash querying less specific, I'm planning on truncating part of the geohash when I query; currently, the query looks similar to this var geoQuerySpecific = GFGeoHashQuery() let geoQueryHash = GFGeoHashQuery.queries(forLocation: (lastLocation?