geolocation

Redirect depending on the Country?

夙愿已清 提交于 2019-12-22 09:25:23
问题 We basically have 2 sites ( Java /JSP / Apache Webserver) : something.ca & something.com The .ca is canadian content, and the .com is american content. We need users to be redirected based on the ip addreess. We want US users to get the .com site and Canadian users get the .ca site. What is the best way to do this (at a webserver level or otherwise ) ? Please elaborate. 回答1: In my web surfing experience, most websites - UPS.com for example - ask the user to select their country site rather

HTML5 Geolocation In Rails

一笑奈何 提交于 2019-12-22 08:44:29
问题 I am trying to grab a users location via HTML5 and pass it to my rails controller. I have the JavaScript below which calls .value on the element and sets it equal to the respective position. I would then like to submit these values through a hidden form field and pass it to my location controller so I can populate locations based on the users position. I know this has been done before and I have seen a few posts on it, but I have not had success. navigator.geolocation.getCurrentPosition(GeoL)

Timezone database with Lat/Lng coordinates

淺唱寂寞╮ 提交于 2019-12-22 08:26:11
问题 I'm looking for a list of timezones with polygon lat/lng information. I want to build a tool that I can punch in a lat/lng and spit out a timezone. Basically the same thing that Geonames and EarthTools does except that I don't want to have to make a web service call or depend on a third-party service with request limits. Any suggestions on where I can find this data? 回答1: Look this website. http://www.geonames.org/ Have daily updates 来源: https://stackoverflow.com/questions/6247432/timezone

Convert between coordinate systems with GeoDjango

丶灬走出姿态 提交于 2019-12-22 08:15:23
问题 I'm trying to add coordinate information to my database, adding django.contrib.gis support to my app. I'm writing a south data migration that takes the addresses from the database, and asks Google for the coordinates (so far I think my best bet is to use geopy for this). Next I need to convert the returned coordinates from WGS84:4326 , Google's coordinate system, to WGS84:22186 , my coordinate system. I'm lost among the GeoDjango docs trying to find a way to do this. This far, I gather I need

Unable to simulate location data in Android emulator

余生颓废 提交于 2019-12-22 08:13:23
问题 I'm trying to test my app, which uses geolocation using the emulator. Several methods are described here. I'm going to Window->Open Perspective->DDMS , then entering lat. and long. one in Location Controls and then I hit "Send". But it doesn't work. Instead I see the following error: Unable to send command to the emulator. Why is this happening!? I don't think my app is the problem because I tested with the emulator's default browser and it also cannot access location info. Details: OSX 10.9

LocationManager requestLocationUpdates doesn't work

风流意气都作罢 提交于 2019-12-22 07:03:04
问题 I'm trying to get the current location in android using LocationManager and LocationListener as described at http://developer.android.com/guide/topics/location/obtaining-user-location.html However, onLocationChanged method of the LocationListener is never called. I've used a real android phone / also used the emulator and simulated location changed using telnet, as described in the link above. Here's my code: public class MyActivity extends Activity { @Override public void onCreate(Bundle

Parsing latitude and longitude with Ruby

我们两清 提交于 2019-12-22 06:02:57
问题 I need to parse some user submitted strings containing latitudes and longitudes, under Ruby. The result should be given in a double Example: 08º 04' 49'' 09º 13' 12'' Result: 8.080278 9.22 I've looked to both Geokit and GeoRuby but haven't found a solution. Any hint? 回答1: "08° 04' 49'' 09° 13' 12''".gsub(/(\d+)° (\d+)' (\d+)''/) do $1.to_f + $2.to_f/60 + $3.to_f/3600 end #=> "8.08027777777778 9.22" Edit: or to get the result as an array of floats: "08° 04' 49'' 09° 13' 12''".scan(/(\d+)° (\d+

How to determine an Android device's current country location regardless of user location settings?

一世执手 提交于 2019-12-22 05:07:42
问题 I need to determine the country (iso3) the device is in even if the user's device has GPS turned off and does not allow apps to access it's location. I also need to account for tablets that have no sim card and thus cannot use telephonyManager. For this reason I don't believe I can use the location manager (also because of these reasons: LocationManager requestLocationUpdates doesn't work) The approach I am thinking I will need is to make a simple HTTP request to a third party ip location api

Google Maps Javascript GeoLocation - Not working on Chrome

泄露秘密 提交于 2019-12-22 04:12:44
问题 Note: The original source for the html quoted below came from http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation_map and Google Maps Javascript V3 geolocation - cannot access initialLocation variable unless alerted I've gathered three different versions of geolocation examples. All work properly in Firefox. None work in Chrome. I've set the Chrome permission to allow all sites to use my location, but still no success. It must be a Chrome setting, but not the obvious one:

How to get last known location for Location manager in Android?

眉间皱痕 提交于 2019-12-22 03:59:08
问题 I am using simple location manager object to get lastKnownLocation() of device but getting null object in return can any one tell me why ? Code : public Location getLocation() { LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); if (locationManager != null) { Location lastKnownLocationGPS = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (lastKnownLocationGPS != null) { return lastKnownLocationGPS; } else { Location loc