geolocation

How to find my distance to a known location in JavaScript

牧云@^-^@ 提交于 2019-11-27 17:54:00
Using JavaScript in the browser, how can I determine the distance from my current location to another location for which I have the latitude and longitude? Frank van Puffelen If your code runs in a browser, you can use the HTML5 geolocation API: window.navigator.geolocation.getCurrentPosition(function(pos) { console.log(pos); var lat = pos.coords.latitude; var lon = pos.coords.longitude; }) Once you know the current position and the position of your "target", you can calculate the distance between them in the way documented in this question: Calculate distance between two latitude-longitude

iOS 8 requestWhenInUseAuthorization no Popup

怎甘沉沦 提交于 2019-11-27 17:26:37
I tried to make my AppProject iOS 8 ready. I had read a lot about [_locationManager requestWhenInUseAuthorization]; and the entry in plist NSLocationWhenInUseUsageDescription So I changed all the necessary code lines. It works fine, but now I have copied my project again from my iOS 7 base to include new features. But when I make the changes for the iOS8 Location Privacy the Popup doesn't appear anymore. My code worked until I copied. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0

Tracking email with PHP and image

六眼飞鱼酱① 提交于 2019-11-27 17:24:36
I have seen the service like spypig.com placing a small image in the email and tracking when it is opened and from where. They track city, country, IP address etc. How is this done? How do we know when the mail is opened? And how is the image generated? How is the IP address detected and how is it possible to know location from it? Basically, in the HTML body of your email, there will be an <img> tag that would look like this : <img src="http://www.yoursite.com/tracker.php?id=123456" alt="" /> When someone reads his mail, with images enabled, the email-client will send a request to tracker.php

SQL Query for Performing Radius Search based on Latitude Longitude

北城余情 提交于 2019-11-27 17:21:29
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 table has about 23k rows. The size of the result set is weird at times e.g. for a 5.4 mile search, it

How do I request permission for Android Device Location in React Native at run-time?

淺唱寂寞╮ 提交于 2019-11-27 17:20:41
问题 I have been trying to use React Native 's GeoLocalisation for an Android App. The poorly documentated module is found here https://facebook.github.io/react-native/docs/geolocation.html. According to the documentation, you handle location permissions on Android using the following code in the AndroidManifest.xml file <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> However, my online research suggests that the above line of code is useless for versions of ANDROID >= 6

How does HTML5 Geolocation Work?

ⅰ亾dé卋堺 提交于 2019-11-27 17:16:47
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 Google WebService to detect the location. Now this seems very strange considering they are competitors now.

Querying within longitude and latitude in MySQL

◇◆丶佛笑我妖孽 提交于 2019-11-27 17:01:53
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! daroczig 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 Locations with MySQL' Geo/Spatial Search with MySQL Citing from the first url: Here's the SQL statement

Developing Geographic Thematic Maps with R

妖精的绣舞 提交于 2019-11-27 16:37:15
There are clearly a number of packages in R for all sorts of spatial analysis. That can by seen in the CRAN Task View: Analysis of Spatial Data . These packages are numerous and diverse, but all I want to do is some simple thematic maps . I have data with county and state FIPS codes and I have ESRI shape files of county and state boundaries and the accompanying FIPS codes which allows joining with the data. The shape files could be easily converted to other formats, if needed. So what's the most straight forward way to create thematic maps with R? This map looks like it was created with an

Get current location during app launch

 ̄綄美尐妖づ 提交于 2019-11-27 16:29:48
问题 Good Day! I am working on an android app which monitors user location. I am using LocationManager to get users location, using the following method public void onLocationChanged(Location theLocation) {} Through the above method, whenever there was a user movement, I am receiving location coordinates. But, now I am planning to get user's location immediately after their app login. Is there any way through LocationManager through which I can manually get the location coordinates after my app

How to geolocalize on custom maps iphone and android

做~自己de王妃 提交于 2019-11-27 16:25:40
My client would like me to implement geolocation in a mobile application. He want me to use a map which is quite deformed (definitely not a google-like map). Is it an easy way to transform the GPS coordinates into the coordinates on that deformed map? I get the coordinates (X0,Y0) from the GPS -> I need the location on my client's map (X1,Y1) Dude, you should try http://trimaps.com . It does exactly what you are looking for! You need to know the mapping from the client map to real world co-ordinates. Either ask your client, or perhaps you could overlay it on a google map of the same area in