geolocation

How to determine if a PHP string ONLY contains latitude and longitude

折月煮酒 提交于 2019-12-03 16:31:16
I have to work with strings which may contain Lat/Long data, like this: $query = "-33.805789,151.002060"; $query = "-33.805789, 151.002060"; $query = "OVER HERE: -33.805789,151.002060"; For my purposes, the first 2 strings are correct, but the last one isn't. I am trying to figure out a match pattern which would match a lat and long separated by a comma, or a comma and a space. But if it has anything in the string other than numbers, spaces, dots, minus signs and commas, then it should fail the match. Hope this makes sense, and TIA! ^[+-]?\d+\.\d+, ?[+-]?\d+\.\d+$ The ^ at the start and $ at

How to load Google ClientLocation API without loading the whole Google Maps API?

折月煮酒 提交于 2019-12-03 16:26:58
All I want to do is find out the person IP address so that I can reverse geocode it to find out their latitude and longitude from which they are viewing my web site from. I can do that using Google ClientLocation API but it's unclear to me if I have to load the huge Google Map framework just to use it. Is it possible to simply use the ClientLocation API without having to load all of Google Maps? If so, how? Yes, you only need to use the ClientLocation object in the google.loader namespace so you need not reference the maps api or anything else. For example. <script src="http://www.google.com

How does the binary DAT from Maxmind work?

主宰稳场 提交于 2019-12-03 16:24:02
Maxmind offers a binary DAT file format for downloading their GeoIP database. http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz Does anyone know how this has been packaged? Also, is there any kind of copy protection on the data? I'd like to offer up a set of data in a similar way. Anyone with any knowledge of this will receive my undying gratitude :-) It's just a proprietary binary format, heavily optimized for IP address querying. It doesn't have any copy protection. If you really want to reverse-engineer the format, take a look at the C# or Java API. I don't know if this

Android: How to keep GPS active until more accurate location is provided?

心不动则不痛 提交于 2019-12-03 16:07:41
I am using the location manager's requestLocationUpdates() method to receive an intent to my broadcast receiver periodically. The system is correctly firing the intent to my receiver, and I have been able to use it correctly. The only problem is that the GPS location provider only stays active for a few seconds after the initial location acquisition, and I need it to stay on a little longer so that the location estimates are more accurate. My question is how to make the GPS location provider stay active for each periodic request that comes from the LocationManager requestLocationUpdates. Does

Android Location return null after Enabling GPS in dialog

冷暖自知 提交于 2019-12-03 16:03:43
When I enter a screen, I check for if GPS is turned on, if not, the dialog to enable GPS is shown. When user clicks Yes, onActivityResult -> GPS is turned on and I try to get the location but this always returns null When I enter the screen with GPS already on, location is retrieved properly. I have been struggling with this for few days now and can't seem to find any resources. UserLocationUtilities.java public class UserLocationUtilities implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener{ GoogleApiClient googleApiClient; Activity

How to determine location of device in Android using IP address

安稳与你 提交于 2019-12-03 15:51:55
问题 I am developing an Android app. I want to determine the location of the device using its IP address. Where do I start? The links on Google APIs are not conclusive enough. Thanks. 回答1: You should use then fallowing API for getting location using ip. Ip2Location API 回答2: Checkout Google Maps Geolocation API Sample POST: https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY Sample response: { "location": { "lat": 51.0, "lng": -0.1 }, "accuracy": 1200.4 } Limits: Users of the

GeoCoding in Rails for polygon bounds [closed]

时光怂恿深爱的人放手 提交于 2019-12-03 15:12:48
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 5 years ago . Is there a way in rails via some mapping API/gem where I can define map areas/map zones (with polygon bounds) and detect if an address falls within a particular zone/area. This is easily done with geokit . First construct a polygon from LatLng: polygon = Geokit::Polygon.new([ Geokit::LatLng.new(0,0), Geokit::LatLng.new(10,0), Geokit::LatLng.new(10,10), Geokit::LatLng

Find closest city to given longitude/latitude [closed]

瘦欲@ 提交于 2019-12-03 15:03:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . 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 回答1: 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

How to get Latitude and Longitude information from picture

倾然丶 夕夏残阳落幕 提交于 2019-12-03 14:37:39
问题 How to get latitude and longitude information from picture store in device or SD Card? 回答1: 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

Free for commercial use google-maps equivalent to do the following?

别等时光非礼了梦想. 提交于 2019-12-03 14:23:23
I'm looking for a mapping API something which has similar functionality to Google-maps but which perhaps has something along the lines of the Apache / MIT license. I basically want to plot points on the map. Does such a thing exist? If so are there any guides to plotting points on this map API? OpenStreetMap (Their Wiki ) http://www.maptools.org/ 来源: https://stackoverflow.com/questions/3938485/free-for-commercial-use-google-maps-equivalent-to-do-the-following