geolocation

Google API for location, based on user IP address [closed]

老子叫甜甜 提交于 2019-11-29 19:58:10
I am looking for a way to get the user's current location (city) based on is IP address using the Google Maps APIs. Something similar to http://freegeoip.net/json but only using the Google Maps APIs. Is this possible? Peter Knego Google already appends location data to all requests coming into GAE (see Request Header documentation for go , java , php and python ). You should be interested X-AppEngine-Country , X-AppEngine-Region , X-AppEngine-City and X-AppEngine-CityLatLong headers. An example looks like this: X-AppEngine-Country:US X-AppEngine-Region:ca X-AppEngine-City:norwalk X-AppEngine

Autofill Address + Google Maps API

好久不见. 提交于 2019-11-29 19:54:50
I want to present my users with a text box wherein they can type in their address. As they type their address, I want to provide the users with suggestions/predictions of what address they are trying to type. I'm also concerned about the relevance of this address (e.g. that the address is not an address halfway across the world). Is this possible? I'm using jQuery. You can use Google Places API to have an autocomplete for address. When address is selected, address_components field contains structured address data (e.g. street, city, country) and could be easily converted into separate fields.

MongoDB with Mongoid in Rails - Geospatial Indexing

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 19:39:37
MongoDB has a very nice Geospatial Indexing feature. How can I use it in Rails with Mongoid? You can define geo indexes like this in mongoid class Item include Mongoid::Document field :loc, :type => Array index( [ [:loc, Mongo::GEO2D] ], background: true ) end And for queries $near command (without maxDistance) location = [80.24958300000003, 13.060422] items = Item.where(:loc => {"$near" => location}) $near command (with maxDistance) distance = 10 #km location = [80.24958300000003, 13.060422] items = Item.where(:loc => {"$near" => location , '$maxDistance' => distance.fdiv(111.12)}) Convert

Make clickable polygons on Google Maps (for Android)

爷,独闯天下 提交于 2019-11-29 19:30:59
问题 I have continuous LatLngs of various areas in a city. Is there any way I can create clickable polygons with it. Once way to go about would be to Generate polygons with the available LatLngs.( I want to visually show the polygons on the map with color encoding) Set up setOnMapClickListener . Do a point inside polygon test. I understand that this is very naive. What are the alternative approaches? 回答1: Here's how I did it. Polygon polygon = getMap().addPolygon(new PolygonOptions() .add(new

How to get Yahoo's woeid by location?

余生长醉 提交于 2019-11-29 19:24:39
问题 // Get woeid by lati/long HttpGet hg = new HttpGet( "http://where.yahooapis.com/geocode?location=" + latlon + "&flags=J&gflags=R)"); HttpClient hc = new DefaultHttpClient(); HttpResponse weatherHR = hc.execute(hg); if (weatherHR.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { if (DEBUG) Utils.log("", "Location != HttpStatus.SC_OK"); return null; } I used this API and it work ok before, but It return a error since today, the HttpStatus.SC_OK is not OK. Has this API been closed? Thanks.

How to use geo-based push notifications on iOS?

妖精的绣舞 提交于 2019-11-29 19:23:53
Is it possible to make use of geo-based push notifications on iOS when the application is killed (not in the background)? I am interested in building an app, where the user will choose a position on a map, and then if he/she for example is close to that area a local geo-based push notification would be triggered. However is this "idea" even possible? Can the GPS run and compare coordinates when the app is killed and run and notify the user when is in place? Is there a tutorial/article/more information of any kind on the subject that i could read? Most of the information I read online were more

Access variables from another method

烈酒焚心 提交于 2019-11-29 18:14:35
i am trying to submit user registration form in android with current location. I am new to android and java development. when i try to access myLat and myLan of the onLocationChanged method in my name value pairs code , it is unable to find both the variables. How can i access both the variables in my name value pair code. package com.imran; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient;

Android webview geoposition database failed to open

家住魔仙堡 提交于 2019-11-29 17:46:27
问题 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

Ordering Firestore GeoHash query from closest to furthest?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 17:00:07
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?.coordinate)!, radius: (30)) as! Set<GFGeoHashQuery> for query in geoQueryHash { geoQuerySpecific = query

Calculating distance (pythagoras) and running count in sql query

半腔热情 提交于 2019-11-29 16:59:24
I am trying to build a rather complicated query in SQL, and being a beginner i would immensely appreciate some help to build it. I am trying to achieve the following: 1/ Calculate the distance between a postcode in the target_postcodes table - say E1 1AA - and all the postcodes in the the population_postcodes table using Cartesian latitude and longitude coordinates using Pythagoras: SQRT( POW(MY_Y_AXIS - Y_AXIS, 2) + POW(MY_X_AXIS-X_AXIS, 2) ) 2/ Create a new column with those distance values, not sure how to do that step 2-bis/ Sort postcodes in the population_postcodes by the distance value