Counting cars on a specific road - google-maps-api-3

I am receiving cordinates from a large number of cars in the city. I would like to associate each car with the nearest road and later count how many cars are on each road. i am using google maps. I would like to know if there is a more efficient approach to what I am doing - I am hand-drawing all major streets and storing the polyline. When I receive a location, I search my database of roads (polylines) and find the nearest road. This is slow because mapping all roads is very difficult and I receive thousands of positions per minute.

Looks like you'd better use a GIS-enabled database like PostGIS loaded with a suitable dataset like OpenStreetMap's data - if the OpenStreetMap data are of sufficiently high quality for your region and your purpose of course.

Related

What algorithm to extrapolate traffic data on graph used for routing (OSM)

I'm planning to use either of popular routing projects OSMR, Graphhopper or Valhalla to find the fastest route including historical traffic data.
Question: I don't have traffic data for all graph edges representing roads (only for a subset), and the missing data has to be extrapolated. What mathematical tools (or ready solutions) can I use to extrapolate/ fill/ guess the missing traffic data given following assumptions:
Ideal arbitrage is performed by drivers. Taking a route without (or partially without) traffic data shouldn't give an advantage.
The routing queries will be limited to an area of a typical European city, say 25km x 25km, what results in a fairly small graph.
The solution can be either: geo-agnostic (refer only on nodes and edge weights) or take into account spatial data ie. physical proximity (or direction!) of graph edges.
Any heuristic can take advantage of the fact that the routing happens for morning or evening rush hours. The traffic significantly differs depending on the direction.
Thank you for your help!

Plot movement over time in (preferably) Google Maps

I have a spreadsheet with columns for person, date, event, place name, latitude, and longitude. This is the result of many years of genealogical research that shows the birth, marriage, and death locations for several hundred of my direct ancestors as they migrated across the world and finally converged in South Africa for the last few generations.
I'd very much like to create an animation or video showing their movements over time, preferably with a marker flashing at the location, then fading away, with or without lines linking the markers for the duration of the person's life. At 9 generations ago this would then show 512 births happening at roughly the same time, moving on to them converging into 256 places as couples got married, then between those 256 marriages and the original 512 deaths, the 256 births of people of the next generation would flash on, and so on, finally converging on just my birth. I believe such an animation would be an excellent way to make the vast family tree accessible in a visual way, and other genealogical researchers would probably also enjoy doing this. The ability to automatically zoom in on the bounding box of the locations at any given time would be needed to show movements within a smaller geographic location, but first and foremost I simply want to plot points over time.
Does anyone know of a free or commercial tool that would allow doing this? I have explored this in most genealogical software solutions but they provide very limited tools showing one person or one couple at a time, so I suspect I'm going to have to plug this into a generic 'plot movement over time' tool in a good map service.
I have used GraphXR for plotting family tree members linked to one of their several maps, with the edges being either a birth, marriage or death date. The data is queried from Neo4j which has a seamless interface with GraphXR.
I'm now working on a Neo4j PlugIn for genealogy and collaborating with GraphXR developers to make such visualizations easier for end users.
It's not exactly what you are looking for, but it may be helpful?
http://gfg.md/blogpost/7

Interesting Python data structure problem involving disjoint sets, hashing, and graphs

Problem: You are planning an around-the-world trip with your two best friends for the
summer. There is a total of n cities that the three of you want to visit. As you are traveling around the world, you are
worried about time zones and airport access. Therefore, some cities can only be visited after visiting another city first,
which is in a nearby timezone or has an airport, which are expressed as a list of pairs (cityX,cityY) (cityX can only be
visited after visiting cityY).
Given the total number of cities and a list of dependency pairs, is it possible for you all to visit all cities?
Your task is to write the function can_visit_all_cities, which determines whether visiting the n cities is possible or
not given the dependencies.
Requirements
• Must run in O(m+n), and cannot use built in Python set/dictionary
This sounds like a dependency-graph. I don't know if python has a built in datastructure for this.
If you were to implement one on your own you'd have to use lists/sets though.

Reverse geocode latitude/longitude coordinates to retrieve landuse data (eg. residential area, highway, etc.)

I would like to analyse the locations of electric vehicle charging stations for Germany, Italy and France. Those three countries, because they differ quite a lot in regard to their respective incentive programmes for public charging station infrastructure.
What I have so far are .csv exports from both OpenChargeMap and OpenStreetMap containing the location data (latitude and longitude) of all charging stations in those three countries along with a few other information that I can process in R.
What I would like to do now is some sort of reverse geocoding on those latitude and longitude coordinates to retrieve additional information on the surroundings. Especially, whether the respective charging station is located in a residential area in a city for example or at a rest stop on the highway. By knowing at what kind of locations the charging stations are placed in those three countries I am hoping to be able to draw conclusions regarding the incentive programmes. I'm not looking for specific addresses in this case, but rather an API or another way to process thousands of coordinates and retrieve information regarding for example population density or any other piece of data from which I could derive conclusions.
I have tried to get OpenStreetMap exports to work, but unfortunately I cannot seem to be able to query for the 'landuse' attribute through the Overpass Turbo API. This is my basic query that I'm using in this specific API, but as soon as I query for ["landuse" = "residential"] instead of ["landuse" = ""] I get prompted empty fields as result.
I found an API from Google which would offer lookup for various address components/types. Unfortunately, registering an API key at Google is not quite realistic for the scope of my work. Does somebody know of a (preferably FOSS) API that is able to do something like this? Or even how to make a 'landuse' query work in the Overpass Turbo API linked above?
Thank you in advance for your time.
Your Overpass API query is looking for elements that are tagged as amenity=charging_station and landuse. This is rather uncommon since charging stations and landuse are mapped as distinct objects. Instead you need to look around charging stations for landuse elements.
So instead of
area["ISO3166-1"="DE"]->.a;
nwr(area.a)["amenity"="charging_station"]["landuse"=""];
you will need a query like
area["ISO3166-1"="DE"]->.a;
nwr(area.a)["amenity"="charging_station"];
way(around:200)["landuse"];
This searches for ways with a landuse tag located within 200 meters of charging stations.
Note that this is a rather heavy query. You should probably use your own Overpass API server for it.

Here API: Map NAVTECH edge numbers to latitude/longitude?

I am using the Here API to search for roads where traffic accidents occur in my home town. My aim is to extract the full road coordinates (as sequence of of lat/lons) where the accident is active in order to draw that road on a reasonable scale.
Using the traffic/6.1/incidents API, I query for the data using a geographical bounding box. An accident in the response is described by one pair of TMC locations as well as one pair of lat/lon geographical points. This data is too coarse-grained for plotting the roadway. (Please correct me if I am wrong here, but I would like to add some more detail about turns of the road.)
My question regards what I found when I turned to examine the rest of the accident/incident response, containing so-called NAVTECH data on this (XML) form:
<NAVTECH><EDGE><EDGE_ID>1150578390</EDGE_ID><EDGE_ID>1150578391</EDGE_ID>
<EDGE_ID>...</EDGE_ID>
<VERSION_ID>201604</VERSION_ID></NAVTECH>
My question is: Is there any available method to map the NAVTECH edges to pairs of lat/lon coordinates?
I have searched Here.com, the here-api stackoverflow tag and tried to Google for an answer, but I find so little documentation on this type of data. I am looking for all information I can find to (i) Describe the NAVTECH edges and their meaning, (ii) How to map NAVTECH to geographical coordinates. In general, (iii) Can I use the Here API to get more geographical information than this about roads where there are accidents?
Kind regards,
Vilhelm from Sweden
You can pass a lat/lon to their routing API and get back the shape point coordinates (and other attributes) for the road edge at that location, like this:
https://route.cit.api.here.com/routing/7.2/getlinkinfo.xml?waypoint=43.066628,-71.471729&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&linkattributes=all
Unfortunately, though, this may not be a long term solution, as seaBass states here:
getlinkinfo will depreciated March 31, 2017. In order to get speed limit information you will have to use PDE (Platform Data Extension) which requires an APP ID and Code

Resources