Let's say I have a lot of JSON data relating to intersections and their geolocations.
I have an app where the user uses his or her current location, and I want to be able to figure out what block they're on (i.e. the street they're on, and between what two cross streets). What's the best way to do this? Is there a good way?
Example: I get the user's geolocation, reverse-geocode it into 435 W. 42nd st. Using that data, I want to know that the user is between 9th ave and 10th ave on 42nd st.
Any help is much appreciated!
You'll need to have the geolocations of each of the intersections, blocks or whatever you want to relate the user position to. Once you have that information, you can easily find the nearest intersections to the user's current geolocation.
If all of the geolocation information is in your JSON data, then work only in geolocations (don't reverse geocode) until you've determine the nearest intersections, etc.
You'll likely do best to convert your JSON data to a database so you can query more easily.
Related
I have a high volume dataset with keys like this:
lat:6.897585,
long:52.785805,
speed:12,
bearing:144
Basically it is a dataset of records of various trips on cars. The data was stored every few seconds during each trip. The main goal of this project is to be able to visualize only u-turns (turn arounds) on a map. But for now, I am trying to at least show the data on specifc roads. For that, I am using Overpass API
With the help of Overpass Turbo, I can get a dataset with all the roads I need.
However, in the dataset, the road's geometry is represented with LineString type.
My question is, How can I get a bounding box(es) of the roads from Overpass API, so later on, I can display events that happened only on the given roads? Or maybe you have a better solution on how to achieve this?
A bounding box wouldn't be very helpful here, as using it to filter your points would show everything that falls within the box (which could include other nearby roads)
It sounds like getting a buffer around a linestring might get you closer, but could still include points that are within the buffer but not on the road you are inspecting.
The smarter way to do this would be to assign each event to a road segment using some logic based on their attributes/properties, so you don't have to depend on a spatial filter.
I'm new to OSM and would like to know if my approach for finding the next intersection ahead is possible when doing it offline.
The goal is to get the coordinates (latitude/longitude) of the next intersection on the street I'm currently driving on. For that I have my actual position (lat/lon coordinates) and heading (w.r.t. the north-pole) at disposition.
My current approach right now is to first use my coordinates for getting the name of the street/way/trace in which I am driving; then use that name for knowing which are the next intersections on that street (to both sides); and then use the heading for knowing which direction is the one I should pay attention to.
Once I have the intersection, I would get its coordinates and continue with the program.
My questions are then, is it possible to do all of that offline, i.e. with a .osm file (or similar)?
And, do you know a better approach for getting the coordinates of the next intersection ahead?
Thanks a lot in advance!
PS. I was able to get the name of the street by using nominatim and to get all the intersections of a street by using Overpass turbo, but this solutions would need internet; or is there a way of using them offline?
Is there anyway, using MapKit, to check if a user is in a building, at a certain address?
I have the users current position (longitude, latitude):
I have a buildings address - for example, 298 Texas St, San Francisco.
Is there anyway I could tell if a user is at that address / in the building?
I have tried converting coordinates into an address, and just checking the address against the other one, however, my problem is that if the address is a house, and the user walks past it, it will return true, when, in reality, it is not.
Thanks for the help!
Addresses are usually reported as "geo-points", which is just a single lat/long coordinate. Without more information, you know nothing about the size or shape of the dwelling that represents the address.
Also, addresses are sometimes entered into mapping databases by interpolating between a starting address/coordinate and and ending address/coordinate. If the houses aren't evenly spaced, the coordinates of a given address can be wrong.
Plus, GPS's are pretty unreliable indoors, especially in office buildings and multi unit dwellings.
As a result, the short answer to your question is no.
You could ask the location manager for lat/long coordinates of the address, and then use another location manager call to get the distance from the user's current location, and use a distance value (20 meters?) to decide that the user is "at that address". That's likely the best you're going to be able to do.
I have city address and state on my server.
I need to fetch data in my iPhone application as per distance range (i.e in miles).
Please give some proper suggestions.
You can use Google Geocoding to get Lat-Long form address.
For example :
http://maps.google.com/maps/api/geocode/json?sensor=false&address=newyork,us
address — The address that you want to geocode.
You can use the google geolocation service, where it will get the Lat long from the address or vice-a-versa.
Please read the FAQ for the same.
Another is Foursquare which also nice to use and provides good data.
This will solve your issue.
You can travel to each of your cities and measure the highest position of some stars.
Through the altitude relation you can calculate then you current latitude.
The longitude is a bit more complicated. You need an accurate clock and a table/chart of star positions/times. Then you take measure the time of the highest position of some stars and compare it to your table. with the difference of this two values you can calculate the longitude of the city.
But there are already people who did that and share their results.
I'd like to know (from a high level view) what would be required to take a pdf floor plan of a building and determine where exactly you are on that floor plan using GPS coordinates? In addition to location, the user would be presented with a "turn by turn" directions to another point on the map, navigating down hallways, between cubicles, etc.
Use case: an iPhone app that determined a user's location and guided them to a conference room or person's office in the building.
I realize that this is by no means trivial, but any help is appreciated. Thanks!
It's an interesting problem. When you're using Core Location, you're not necessarily using GPS. Using WiFi and cell tower triangulation, you can get pretty good location results. So from Core Location you get a latitude and longitude fix. (You might also get altitude info, since GPS data is 3-dimensional. You also will get an accuracy value.)
So you have lat and lon. You need to map these coordinates to the PDF plan's coordinates. Assuming that the plan is aligned with the latitude and longitude lines, and that you have a lat-long fix for one of the points on the plan, you need to calculate the x-axis scale and y-axis scale. Then it's some calculations to map the lat-long to x-y coordinates on the PDF plan.
GPS may not be accurate enough for this purpose, especially indoors. Assuming errors on
the order of 10 meters, you'll have difficulty determining which floor the user is on.
Here's a neat (?) idea that might work: can you post some "You are here" placards
at various locations around the building? You could label each one with a unique,
machine-readable location code (maybe a QR code or something similar), then take an
image using the camera, have your app read that image and interpret the location code,
and use that instead of GPS to determine the start location.
GPS inside? That's your first -- and biggest -- hurdle.
Next hurdle is knowing the GPS coordinates of at least three points on that PDF to define the plane of of your map in the real world. (The PDF will need to be to scale, of course.)
So that gives you where you are on the PDF. Now you'll need to figure out some way to determine where you can walk (or where you can't) to get directions.