geolocation

postgres spatial indexing

有些话、适合烂在心里 提交于 2019-11-30 23:58:31
I can't seem to find much documentation on this. What's the simplest way to create a database/table on postgres supporting a query like this SELECT * FROM table WHERE distance(POINT(0,0), table.location) <= 1000m; Where POINT(0,0) and table.location should be latitude/longitude pair, and 1000m is 1000 meters. And how should I go about indexing that table? Thanks. PostgreSQL support indexes on expressions and also partial indexes, you can probably mix them. This is just a random guess, I don't know if it works, but give it a try: CREATE INDEX foobar ON table (distance(POINT(0,0), location))

Finding a coordinate in a circle

久未见 提交于 2019-11-30 23:13:39
I am doing a mashup using Google Maps under Grails where users can create geofences by selecting a point on the map and a radius. This get stored on my database and the application receives constantly a set of coordinates from a GPS device. I would like to compare the received coordinates with the area stored in the circles. If the point is inside (or outside) the circle the program will fire an action. However, I would like to know how I can find out if the coordinates are located inside/outside the circle. There is a Javascript library which allows doing this but I need to do this on the

Ways to get location of the client from the browser?

一世执手 提交于 2019-11-30 23:08:00
What i need is the lat/long of the client(via browser) Found some articles on the net,found some in stack overflow itself(an old article) Get GPS location from the web browser . it was answered almost 18months ago -- wondering if there's any other(more efficient) way of getting the information of the location of the user from the browser. Soo far,found 2 using Maxmind http://coding.smashingmagazine.com/2010/03/08/entering-the-wonderful-world-of-geo-location/ Other,using google's api http://briancray.com/2009/05/29/find-web-visitors-location-javascript-google-api/ w3c's geo api will have

Need help optimizing a lat/Lon geo search for mysql

為{幸葍}努か 提交于 2019-11-30 22:46:23
I have a mysql (5.0.22) myisam table with roughly 300k records in it and I want to do a lat/lon distance search within a five mile radius. I have an index that covers the lat/lon fields and is fast (milisecond response) when I just select for lat/lon. But when I select for additional fields in the table is slows down horribly to 5-8 seconds. I'm using myisam to take advantage of fulltext search. The other indexes perform well (e.g. select * from Listing where slug = 'xxxxx'). How can I optimize my query, table or index to speed things up? My schema is: CREATE TABLE `Listing` ( `id` int(10)

$geoNear matching nearest array

让人想犯罪 __ 提交于 2019-11-30 22:06:38
I have document in record collection Mongodb (3.4) like below :- { "_id" : ObjectId("592d0c78555a7436b0883960"), "userid" : 7, "addresses" : [ { "apporx" : 50.0, "loc" : [ -73.98137109999999, 40.7476039 ] }, { "apporx" : 15.0, "loc" : [ -73.982002, 40.74767 ] }, { "apporx" :10.0, "loc" : [ -73.9819567, 40.7471609 ] } ] } ` I created index on this collection using below query :- `db.records.createIndex({'addresses.loc':1})` when i execute my below query :- `db.records.aggregate( {$geoNear : { near : [ -73.9815103, 40.7475731 ], distanceField: "distance" }}); this result gives me distance field

Auto fill country and city from zip code, and the oposite

感情迁移 提交于 2019-11-30 21:59:01
I am trying to make a simple form that requires address and zip code, so I was wondering if there is a way to auto populate those fields based on what the user has already typed. So for example if he decides to enter only the zip code the city and country fields will be filled automatically and vice-versa. After searching a while I found these databases that I could possibly use Link 1 Link 2 But apart from that I am not sure how to do this using PHP and MySQL. any help would be appreciated. *This is very easy what u need to do is just get the zip code from the user and with that you can get

geolocation without requesting permission

南楼画角 提交于 2019-11-30 20:47:56
Ive noticed that modern html5 based geolocation always asks the user "do you want to share your location with this website?". Which is fine, but I know there are other routes of trying to determine a ballpark geolocation without having to request this permission. If I recall, these services uses ip databases to try to track geolocaiton info and provide it to a web app. So, in my website I would like to get a "best guess" at the user's zip code, without the geolocation permission being requested. What's the simplest and/or best method of doing this? IP geolocation is less accurate, but you don

MKMapView MKCircle renders a circle with too big radius

 ̄綄美尐妖づ 提交于 2019-11-30 20:44:09
I'm facing with a strange behaviour of MKCircle appearance. Basically I'm trying to draw a circle with a radius of 8500 km with an arbitrary center. Here is my code: private func addCircle() { mapView.removeOverlays(mapView.overlays) let circle = MKCircle(centerCoordinate: mapCenter, radius: 8500000.0) mapView.addOverlay(circle) } I also have a custom double tap gesture handler, which overwrites the standard one for map view and allows to change the map center by double tapping on the map view: private func configureGestureRecognizer() { doubleTapGestureRecognizer.addTarget(self, action:

Saving variables outside of navigator.geolocation.getCurrentPosition? (javascript)

限于喜欢 提交于 2019-11-30 20:41:32
I'm trying to play with the scope of js to pull a variable out of navigator.geolocation.getCurrentPosition var lat; function callback (position) { lat = position.coords.latitude; } navigator.geolocation.getCurrentPosition(callback,fail,{timeout:10000}); // after getCurrentPosition succeeds alert(lat); // this alerts null The above code cannot store position.coords.latitude in the lat variable because of the scope. Is there a way to do this? You have to remember the async\ajax nature. this is the execution order of your code: var lat; alert(lat); // this alerts null navigator.geolocation

Geolocating 802.11 access points by MAC address using Google Geolocation API

♀尐吖头ヾ 提交于 2019-11-30 19:52:51
Support for the Google Geolocation API is now built in to most browsers. They do this, in part, by sending to Google the MAC address of nearby 802.11 access points (those whose beacons are captured by your computer.) I have a large number of 802.11 packets captured from various locations. I'm looking to geolocate the 802.11 access points. Assume that we only have their mac addresses. This should be possible by using the Google Geolocation API. Sources that I've found to date that might be helpful on this include: Geolocation source code from Mozilla 1.9.1 code base MDN article on Monitoring