Google distance matrix api issue with zipcode with different formats - google-distancematrix-api

I need to get drive times for a place to the nearest airports. There is a service which is already in place which gives me the address of the place as well as the address of nearest airports in the north america region. One airport has a 5 digit zipcode, one has the zipcode this format 83402 4906, other has a zipcode in this format(canada) A12 123
The distance matrix api is not accepting all other zipcode formats apart from the 5 digit one. If I remove the space its not working.
I need to get the drive times irrespective of the zipcode format

Related

how to to extract images(google map) of a sector in a capital city, in python?

I am working on google map images based location classification problem here in a capital city, I want to get access to the images dataset, of any capital city so that i can do the classification on that basis, so how will i get such a dataset.i am willing to access the dataset.

Finding combination of trainstops through Europe

I am currently working on a school project. The objective is to find a route through Europe from trainstation to trainstation, from country to country where the names of the consecutive trainstations have to start with the letters of the alphabet consecutively and a country can only be used once. To give an example route:(Amsterdam Central, Netherlands) --> (Berlin, Germany) --> (Carcasonne, France) etc. Countries also need to be neighbouring countries. We have received a dataset in which countries and some of their specific stations are mentioned. Some of the countries don't have a large selection of stations, making it important that a certain letter is used with a certain country, because only a small selection first letters will be present for this specific country. Can someone maybe provide me with some guidance as to how I can tackle this problem. I am currently coding in python.
cheers!
- Sort countries in order of increasing number of letter choices
- Loop C over countries in order of increasing number of letter choices
- Place C in position for a random letter that it provides
- IF neighbouring positions have been populated, but they are NOT neighbours geographically
- THEN choose a different letter for those available in C
I would use a constraint solver for this. (I'm familiar with CP-SAT because I use it at work, but you have options.)
For each letter from A to Z, create a variable whose domain is the set of stations whose name starts with that letter. Create 26 corresponding country variables and, for each corresponding station variable and country variable, add a table constraint to ensure that they describe the same thing (so the table contains entries like ("Amsterdam Central, Netherlands", "Netherlands"), though you have to translate into integer indices). Add an all-different constraint on the country variables. For each pair of consecutive country variables, add a table constraint that they be neighbors.
The solver contains a powerful deduction engine that will surely pick through the possibilities much faster than brute force or simple heuristics.

How to match two locations in android programmatically?

I am building an android app with kotlin in which a user set a location and after user visit the set location some function will be triggered. I have built the app to get longitude and latitude of the user location and set location, but how to equal these two locations so the function will be triggered.
For example:- A user set a location whose Longitude & Latitude are 28.690040, 77.208654. After user reach this location the Longitude & Latitude are 28.690041, 77.208653. So by reaching the exact location, user's location is not equal to the set location and hence the function will not be triggered.
Your equality differs at the sixth decimal place, So what you can you do is to round up the lat and long to is to round up to 5 decimal place or even 4 decimal places.
According to an answer in the Stackexchange,
fourth decimal place is worth up to 11 m
fifth decimal place is worth up to 1.1 m
sixth decimal place is worth up to 0.11 m
So you should prefer fifth place or fourth place, depending on your requirement.

How to design ElasticSearch document(s) for geo shape data?

I'm trying to build a geoloc service (from France only) with Elastic Search. I have several indexes to create such as country, region, county, city, neighbour containing itself a polygon.
For each city, I have a list of the nearest cities to include.
How should I design this kind of data, I would like to be able to:
search by coordinates
search by full text
search by zip code, city name, neighbour name
manage faceting (n cities in n county in n region for instance)
etc...
I don't know if I have to use the path Hierarchy Tokenizer pattern.
I was trying to build a unique index Neighbours by referencing the data from the bottom to the top(neighbour => city => county => region => country). But I don't know if it's a good idea regarding the volume of data. (1 country, 40 regions (old + new ones), 101 counties, 36000 cities and 7700 neighbours), especially the polygones.
Any idea?
Thanks in advance!!

Need to sort postal addresses in a database table in sequence

I'm developing an Android app that has postal address routing in it.
We would like to sort each address in a database table in such a way where each address can be printed out for our driver. We don't want to spend time sorting addresses ourselves when a database table would be ideal for that.
I was thinking somehow to create a primary key in the table on a number that we can easily sort in ascending order. That would make it easy to create a manifest for the driver.
I was researching and found that there was something called WOEID (Where on Earth ID) which I think represents a region but I'm not sure if it would be good for us since 2 postal address in the same neighbourhood could use the same WOEID.
For example these 3 addresses have the same WOEID:
100 Bowden St., Lowell, MA
131 Stedman St., Lowell, MA
50 Stromquest Ave., Lowell, MA
The concept of using a single number like WOEID is perfect for us but we need to sort addresses like these in order so we know which ones are closest to each other.
Maybe there is a web site we can use to send out a request from within our app providing them with the postal address and the site will return a single number representing that address in a format our app can parse.
Maybe there is a way to Geocode or convert latitude and longitude numbers into a single number we can use.
Thanks.
So the problems arise when multiple addresses share the same WOEID? I don't know how many resources are available but couldn't it be in idea to fed this data to some API like Google Maps and calculate the distance from your position to there?
If you want to avoid google a really basic approach could be to do the calculation by yourself. (Though this would be more of an estimation.)
However I got the feeling you want to find the best route over total distance so I think your problem is also related to the travelling salesman problem
Given a list of cities and their pairwise distances, the task is to
find the shortest possible tour that visits each city exactly once.
I found a web site that allows me to do a reverse Geocoding. It returns a latitude and longitude.
I experimented a bit and found that I can add the latitude and longitude together to get a single number. Since giving an exact address to the web site will give results not completely what I'm looking for I give it just a street and city and US state to locate. I can then use the latitude and longitude returned and then sort the house addresses in numeric ascending order.
For example we have many streets that are very grid like so 1 number from the adding of the latitude and longitude represent many homes on 1 particular street. On another street a block away I did the same thing. Now all I have to do is just list everything in the database table like this:
City chosen by a dropdown, US state also chosen by a dropdown, then the geocoded number for each street followed by the home numbers.
Here is the web site I used to get the Geocoding along with a sample street address:
http://where.yahooapis.com/geocode?q=stedman+st,+lowell,+ma

Resources