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.
Related
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?
I am currently working with OSRM and used some GPS data for testing which i generated using googles Interactive Polyline Encoder Utility
https://developers.google.com/maps/documentation/utilities/polylineutility
The concept im going for is that a car is driving along a street sending every 20 seconds its GPS location. I want to display the path and the kilometers it drove at the end of its trip.
I set up a Client in C# performing a GET request with the match algorithm to communicate with the api on the open demoserver backend http://router.project-osrm.org
The problem is that i cannot use the match algorithm because it only takes two GPS points instead of a polyline consisting of several GPS locations. To me this does not make sense.
I tried this and it worked not that bad but it lost track and somehow ended at a point i didn't define, probably because of the quite long distance between the two points but i need it to work for more than two though:
here's the picture of it where it went wrong
http://router.project-osrm.org/match/v1/driving/13.682632,47.393753;13.6849281,47.3935649?overview=full&radiuses=49;49
I also found some decent blogs and websites telling me that I should use the OSRM matching algorithm as a Snap to road tool. One of them is this one: https://www.jamesrcroft.com/2015/06/snapping-gps-tracks-to-roads/
I also tried the route method which according to the OSRM wiki finds the fastest route between coordinates in the supplied order. Thats not exactly what I want. At least it could take a polyline of GPS locations but it was always extremely inacurate and faulty.
This is the GET Request for the method route I used:
Pic of how it looked before OSRM, it is slightly inacurate so i want it snapped to the road:
string polyline = #"kz~dHclrbBbAfAn#iBb#{Cf#aBXkA_#s#m#i#_A}#c#c#Fu#Tq#ZWXT";
string.Format("http://router.project-osrm.org/route/v1/driving/polyline({0})?overview=full", polyline);
As response i got this polyline in the attribute geometry:
mz~dHalrbB`#b#XZFFFHBK#CBI#E\\uA\\mA?[?SH[Ru#Nm#XkAFOg#a#m#g#AA}#_Ac#c#IIPk#Tq#Nc#?A??
This is what i got when I decoded it through the google polyline encoder: a complete mess..
Could someone explain what I am doing wrong? Thank you in advance!
I am sure the problem is that you do not send the timestamp of each geolocation in unix time.
Take a look at the official documentation: http://project-osrm.org/docs/v5.5.1/api/#match-service
This is how your request should look like:
http://router.project-osrm.org/match/v1/driving/13.682632,47.393753;13.6849281,47.3935649?overview=full&radiuses=49;49×tamps=1563459949;1563460007
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.
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.
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.