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.
Related
Good afternon! How can i get a route summary for each country in the route? For example, I want to move from Ukraine to France. I get route from GetRouteDirections, the route runs through 4 countries, and i want to see - how many kilometers this route takes over each of the countries of the route
Currently the Azure Maps routing service does not provide an option to return this information, although it is something being considered as a future feature. I have seen this question in the past with other mapping platforms, and there was nothing out of the box for this in those platforms either.
That said, if you want to achieve this today you can do the following:
Get a set of country boundaries that are suitable for your users (if you have users in countries that have disputed borders, you will likely need several sets of country boundaries).
Calculate a route and use path to create a line.
Calculate the intersection of the line with each country boundary and then measure the length of the section of line that intersects.
I've done this as a proof of concept in the past using a set of GeoJSON country boundaries and the JavaScript topology suite (https://github.com/bjornharrtell/jsts). I haven't posted the code online as country borders are disputed in some regions and thus, any sample I put out there wouldn't work globally.
A global solution could be achieved by retrieving the country boundaries from Azure Maps, but you would need to retrieve the boundaries for all countries first, which would be a bit time consuming and generate a lot of transactions.
Tilestache doesn't serve polygons that are self crossed. like in the picture below.
I checked whether or not the polygon is stored within my postgresql, and it was the case. Therefore, the problem comes in serving, I kind of think that tilestache is not able to treat self crossed polygons. Any ideas ?
That is because a self crossing polygon is invalid in the OGC simple feature model. I can't think of a single program that will correctly display them.
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.
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.
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.