Data source for all the roads in the world? - database

For no reason in particular, I'm curious what the expected number of feet you would have to walk to find the nearest road is, starting from a random point on the world, facing a random direction. I can write a program to compute this value, given the right data source.
Is there any data source containing all the roads in the world? For example, Google Maps has roads for many cities around the world. Is there any way to get access to that data? Is there an API for this kind of query?

OpenStreetMaps has the data you are looking for. You might want to look at the FAQ. Here is a link to the data page

No.
You may get about all roads for 1st world countries, which will be a lot. But countries Somalia, Congo, Bhutan? Half of their roads don't exist on any map, including official maps of their own governments. Half of these that do aren't digitized, only on paper. Many of those are restricted by military.
You may find services that would provide all the easily purchasable civilian-available road maps of the world. But not all roads have been mapped, not all maps digitized and not all digital maps published or made available. And many are hopelessly outdated too.

Related

How to calculate distance between two zip code from bing map service

I want to calculate distance between two zip code by bing map API. Is there any possible way to do this I tried this link but this is not for two zip code. Is there any way to do this.
I Pass ZIP1- 34481 and ZIP2- 34705 and want result 70.9 in miles
i calculate this direct from bing map. Thanks for your response
From reading the article, the example as stands will give you a GEOGRAPHY point object (although not sure if your inputs are valid, it seems it require a street address). Anyway, call it twice then to determine the distance between the points returned use something like
Point1.STDistance(Point2)
Here's the BOL reference https://msdn.microsoft.com/en-us/library/bb933808.aspx
Alternatively, see this question for a Bing Routes API answer. How to calculate the driving distance between two points?
If you still need to geocode the approx centre of a zipcode, you might be better off importing the data yourself. I did this recently for the Australian GNAF data (https://www.rednotebluenote.com/2016/04/importing-psma-geocoded-national-address-file-g-naf-to-sql-server/ ) which you might find useful background reading. For US I believe http://census.gov/ makes something similar available.
Hope this is of use.

How can I build a list of world geo locations and their relative geographical hierarchies?

I want to build a database of geographical locations and would like to be able to identify locations that fall inside other locations. For example, The Empire State Building is going to have one geo-coordinate, but my database would be able to tell me that it falls inside Manhattan, which falls inside New York City, which is in the state of New York and so forth.
I've been looking at OpenStreetMap which seems to have a pretty decent database but as best I can tell, I would need to create a set of polygon structures representing each region and then detect if a coordinate falls inside a given region's polygon. Is there a better way to do this, or is there a data source where all of this has already been calculated?
Try the Yahoo! GeoPlanet Data at http://developer.yahoo.com/geo/geoplanet/data/
It is already organised into a hierarchy structure, countries, admin divisions and places.
You can also extend the data by using the 'Geo' methods of the YQL API at http://developer.yahoo.com/yql/console/
You also may want to look into the Geonames database. While it is not classified using hierarchical method, you could probably derive the information out of it.
If you really want to dive into building a geographical database where you can analyze the data, take a look at loading your data into the free/open-source PostgreSQL/PostGIS stack. With that you can actually write SQL that answers questions like "show me all points [within a city/county/state boundary]" or "[within X distance from Y location]".
Good places to learn more about PostGIS is at the BostonGIS website, the GIS.StackExchange pages, or of course the manual but who reads those anymore...
I'm pretty sure the google maps API has regions defined as polygons. And by regions I means, State, City, Zip Code, or just about anything that could be defined as a "region"
You would have to hit-test (Google Maps might have a function for this already) a point to see if it is inside a polygon.
You could also use the lookup address by GeoLocation functions to find which region(s) a point resides in, and just use that.

(bing) maps: +5000 pinpoints

I am building a map application with the silverlight bing maps control.
In the map control I want to show all of the subscribed customers.
The amount of customers is somewhere between 5000 and 7000, this means I can't show them all at once. This would result in a crash I guess.
How would you solve this issue?
I've read about events on zoomlevels etc. about tile layers about spatial sql
but I have no idea what the right solution is in this situation and where to begin.
This seems like a pretty basic problem when working with maps but there is little to no information on how to handle lots of data when working with bing maps.
Can anyone explain or point me to a good tutorial?
You can use a space-filling-curve or a spatial-index to get those points nested with the zoom-level of your map application to achieve a cluster effect http://blog.notdot.net/2009/11/Damn-Cool-Algorithms-Spatial-indexing-with-Quadtrees-and-Hilbert-Curves. There are many implementation of sfc and hilbert-curves. I've uploaded my own at phpclasses.org (hilbert-curve, bsd licence) and with a quadkey function for a cluster function. I've succesful implemented it for some customers. The idea is to search for a quadkey from left to right to get only a portion of pois. www.maptiler.org uses a quadkey with a z-curve. Probably you are getting better answers at gis.stackexchange. A sfc has usually a constraint of power of 2.

Duplicate image detection algorithms?

I am thinking about creating a database system for images where they are stored with compact signatures and then matched against a "query image" that could be a resized, cropped, brightened, rotated or a flipped version of the stored one. Note that I am not talking about image similarity algorithms but rather strictly about duplicate detection. This would make things a lot simpler. The system wouldn't care if two images have an elephant on them, it would only be important to detect if the two images are in fact the same image.
Histogram comparisons simply won't work for cropped query images. The only viable way to go I see is shape/edge detection. Images would first be somehow discretized, every pixel being converted to an 8-level grayscale for example. The discretized image will contain vast regions in the same colour which would help indicate shapes. These shapes then could be described with coefficients and their relative position could be remembered. Compact signatures would be produced out of that. This process will be carried out over each image being stored and over each query image when a comparison has to be performed. Does that sound like an efficient and realisable algorithm? To illustrate this idea:
removed dead ImageShack link
I know this is an immature research area, I have read Wikipedia on the subject and I would ask you to propose your ideas about such an algorithm.
SURF should do its job.
http://en.wikipedia.org/wiki/SURF
It is fast an robust, it is invariant on rotations and scaling and also on blure and contrast/lightning (but not so strongly).
There is example of automatic panorama stitching.
Check article on SIFT first
http://en.wikipedia.org/wiki/Scale-invariant_feature_transform
If you want to do a feature detection driven model, you could perhaps take the singular value decomposition of the images (you'd probably have to do a SVD for each color) and use the first few columns of the U and V matrices along with the corresponding singular values to judge how similar the images are.
Very similar to the SVD method is one called principle component analysis which I think will be easier to use to compare between images. The PCA method is pretty close to just taking the SVD and getting rid of the singular values by factoring them into the U and V matrices. If you follow the PCA path, you might also want to look into correspondence analysis. By the way, the PCA method was a common method used in the Netflix Prize for extracting features.
How about converting this python codes to C back?
Check out tineye.com They have a good system that's always improving. I'm sure you can find research papers from them on the subject.
The article you might be referring to on Wikipedia on feature detection.
If you are running on Intel/AMD processor, you could use the Intel Integrated Performance Primitives to get access to a library of image processing functions. Or beyond that, there is the OpenCV project, again another library of image processing functions for you. The advantage of a using library is that you can try various algorithms, already implemented, to see what will work for your situation.

How can I store a video with proper indexing

How can I store a video (either in database or file system) so that instead of starting streaming from starting I can start this streaming from any fix index.
Main aim is like I have a large video of roads of New York from one end to other and corresponding map of New York save on a central server. Now a user opens up the website and selects the two points on the map of New York and video of road between those two points starts streaming, not from starting but from first point to second point given by user.
So main requirement is to store a video with its indexes such that I can start streaming from any of the index.
Edited Part :
Actually I am planning how to store video of complete city so I can show it to user whenever he selects it on map.
So Now Main question in my mind is can I merge video for all roads in one video like various linked lists (Roads). Like if there are two turns at particular point then instead of storing two videos from that point for different path can I store them in a single video such that which video you have to play will depend upon starting and ending point selected by user and shortest path between those two points, But can I store video of all roads as a single video.
How can I do this, will it depend on stream mechanism or on storage ?
Thanks,
GG
I guess that this all depends on the capability of your playing/streaming mechanism. I would find out about these before determining how to store the file and/or "index" points. Ask some specific questions about your streaming technology, such as:
can you fast forward to a certain point?
can you stop at a certain point?
can you play one stream after one ends?
another play capabilities that may help solve this?
If you can trigger the playing of your video to fast forward to a certain point, you can store the amount of time or frames to fast forward from the beginning and associate these with your map start. You would also need to "abort" the stream at a certain point, that matches your map end point.
However, if you can not fast forward your stream, you many need to break your video file into smaller segments and start at the proper one based on the map point selected. You would then need to play multiple files until you reach the end point.

Resources