As a way to meke it more interactive, I will use the demo from this page: https://developer.here.com/documentation/examples/rest/traffic/traffic-flow-proximity-shape-fc
Here is an example of an API call:
https://traffic.api.here.com/traffic/6.1/flow.json?prox=51.2141%2C4.4551%2C10&locationreferences=shp&responseattributes=fc&app_id=devportal-demo-20180625&app_code=9v2BkviRwi9Ot26kp2IysQ
Response:
{
"RWS": [],
"MAP_VERSION": "",
"CREATED_TIMESTAMP": "2020-05-28T12:05:18.000+0000",
"VERSION": "3.1",
"UNITS": "metric"
}
The result is empty, but clearly, S County Road 250 W is within the circle and I would expect that the request would return the functional class of this road.
Note that if I use TMC, then I will get a ton of information about roads/locations that are not in the circle.
Am I doing something wrong? All I need are roads within the circle, and their functional class (ideally supplied with traffic information). Is that possible?
API is giving correct response however the problem is, that even if you can specify 1 or 100 meters as radius the service really support only the smallest resolution of 1 km. This is due to how the data is stored in the service, which is tile based.
and each such a request is then converted to tiles - which have a predefined size. So a 100 meters request can end up in a tile of size 1x1 km easily. That is why you get traffic outside of a smaller proximity.
You can refer to Here Traffic API Documentation to get the response elements and meanings documentation.developer.here.com/pdf/traffic_hlp/6.0.85.0/Traffic%20API%20v6.0.85.0%20Developer's%20Guide.pdf. You can also go to `
developer.here.com/documentation/versions
and download this file.
Related
I need to be able to evaluate how remote a location is given its geographical coordinates. I rate remoteness based off of a few key metrics, so far, I am only able to calculate a subset of all the required metrics:
The cellular reception at the given coordinate. More specifically, the density of cell towers around the coordinate. This can be found using opencellid.org.
Elevation. This can be found using Google's Elevation API
How can one find these remaining metrics for remoteness?
The type of natural feature the coordinate is in. (eg. Lake, River, Glacier, Ocean, Island, Mountain)
Distance to the nearest road. (Google's Snap Road API and Nearest Road API only work if the coordinate is within 50m of a road, that will not work as some coordinates are hundreds of km from the nearest road).
About land type
For your first question it has already been answered here, except it is only for land/water.
My approach would be the following:
Using maps static, you get the image at your coordinate, you get the pixel at the center of your image (your coordinates) and you use a hashmap/dictionary that contains all the different possible colors and their land type, would be very quick to implement. But you can find out different ideas by reading the first link provided.
For strength of cellular signal
As for your second question, you can use Google API to detect the closest cell towers object, using the locationAreaCode that you can obtain through the coordinates:
An example cell tower object is below.
{
"cellTowers": [
{
"cellId": 170402199,
"locationAreaCode": 35632,
"mobileCountryCode": 310,
"mobileNetworkCode": 410,
"age": 0,
"signalStrength": -60,
"timingAdvance": 15
}
]
}
What is the purpose I wonder? You could take a sampling of coordinates around the fix and if they are mostly on a hill or in water it is definitive, it seems people know how to figure out this kind of stuff with google apis.
Would this be good enough?
Get Lat/Lon and range from a sources like this: https://my.opencellid.org/dashboard/login?ref=opencellid for free. Use a formula to determine the distance between the gps locations like this: https://nathanrooy.github.io/posts/2016-09-07/haversine-with-python/. Then make your own determination on strength based on "range" and terrain. perhaps create a DB table of say 500 zip codes with label for terrain type rating. If 10 or something it's the worst terrain and you drop the strength by something that makes sense.
Does anyone have suggestions regarding APIs available (free and paid) for posting a lat/long and the API returning a geoJSON shape file built from the lat/long posted?
For example, if I want to a shapefile of a 50 meter circle, derived from a lat/long 42.38567/-86.26877 CenterPoint, are there APIs that can do that? I have 24,000 locations I need this for, and I would very much like not to hand draw 24K polygons on a map.
I've investigated turf.js and developer.here.com but the documentation has been pretty unclear on what endpoint to post to, to solve this problem.
Most geographical libraries have buffer method, meaning they can do it locally (you don't even need any external API).
E.g. geopandas has buffer(distance, resolution) method - distance controls the radius, and resolution tells how precise the circle has to be. You construct point, call buffer method - get circle (approximated as polygon) as output.
Or you can load these points to a database with geospatial functionality (say, PostgreSQL + PostGIS) and call ST_Buffer method to do the same.
I'm working on a iPhone app that stores location data from a user. However, sometime the user doesn't have service.
Is there an API that estimates location data when the phone gets back into service? Or any other suggestions
No, there is no such API, because that would create wrong locations.
You have to write yourself such a method, that hopefully works in the scope of your application demands:
E.g You could do a linear interpolation when the GPS service has an outage for some seconds.
e.g:
A liner interpolation of lat and lon values work without special geographic calculations.
Just it would not work if you cross the datum limit (border longitude = 180E to 180 W),
and maybe not if you cross the poles.
But both situations will practically not happen.
I am developing a location-based application in which I need to get nearby location name of any geopoint selected by user. I'm using Google Places API which is working fine for me.
Only problem is the service returns null for geopoints in water. Is there any way that I can retrieve nearby locations for a geopoint in water or ocean?
AFAIK the API has no way to do that.
So, you've got two options, in order of the effort it takes:
When user taps water just throw a dialog saying "Please select a
point on land". Next to no effort and will slightly annoy the user.
Try to find the closest land geopoint yourself and use it to run the API request on
(instead of the original point). Below are some ideas on that.
A good approach can be based on this answer: basically you can get a KML file with land polygons. For performance reasons, you can simplify the polygons to the extent that makes sense for your zoom levels. Now if your point is in one of those polygons -- it's sea. And you can simply iterate over all polygon edges and pick the one that's closest to your point, then pick a point on it - again closest to your point - and do one little epsilon-sized step towards the outside of the polygon to get a land point you can do a geocode request on. Also, the original author suggests you can use Haversine formula to determine neares land point -- I'm not really familiar with the appliance of that one.
The downside is, you have to deal with KML, iterate over a lot of polygons and optimize them (and lose precision doing that, in addition to possible differences between marineregions.org data and Google Places data)
Another cool trick you could try is using Sobel Filter [edge detection] on the visible map fragment to determine where coastline is (although you will get some false positives there), then trace it (as in raster->vector) to get some points and edges to calculate the closest land position with, in a manner similar to the former approach. Here's a clumsy drawing of the idea
For Sobel edge detection, consider GPUImage lib -- they have the filter implemented and it's probably going to work crazy fast since the lib does all the calculations on GPU.
UPD Turns out there's also a service called Koordinates that has coastline data available, check the answer here
I'm attempting to stream Tweets from the UK as a whole, using Twitters stream API, however I'm having trouble with my bounding box.
The LAT/LON pairs I'm using to define a bounding box of the whoe UK(Ire included) is as follows.
-9.05, 48.77, 2.19, 58.88
However when I try to use this with the Twitter stream API, it states the following error message.
Location track must be less than 1 degrees on a side: LocationTrack(48.77,-9.05,58.88,2.19)
I can't imagine that Twitter do not allow you a specify a bounding box that covers an area that crosses between the negative/positive LAT. Am I missing something here, or would this mean that Twitter only allow you to stream if you are in the Wester hemishphere, effectively?
If anyone has a suggest as to how I might be able to over-come this, I'd be very interested in hearing you out.
The reason for this is ambiguity around the meaning of the word 'degree' in this error.
Due to the lat/lon coordinates being used, I assumed it meant the actual VALUE of the degree in the second lat/lon pair, where as in actual fact it means the SIZE of the bounding box.
My bad.