Arranging routes to different drivers based on miles and time - dispatch

I have to set up drivers as driver1,driver2,etc.. by arranging addresses based on city,time and miles.How do i achieve this in Python.
enter image description here

Related

Database schema to map Hotel Amenities from different sources into a uniform format to remove duplicates

I am creating a hotel application that fetches hotel feeds from different sources and store it to database to form a uniform structure and expose API to the mobile application. I am fetching hotels from 3 different sources using python/django app.
Now every hotel source has different sets of amenities for example:
Source 1 [Expedia]
- Free WiFi
- Hairdryer In Room
- Cable TV
- Double Bed
- Single Bed
- Fireplace
Source 2 [SomeHotelProvider]
- WiFi
- Hairdryer
- Television
- and so on
So here we have same amenity name with different name (Free WiFi and WiFi ) for example. The only problem is that at the Mobile screen it will display two filter [Free WiFi, Wifi] to filter out the result set. So what is best approach to deal with these duplicate values.
Need a solution to create a mapping table that maps all duplicates to one amenities master table.
Thanks in advance.
I would use a JSONB column so you can accept any type of data. in a hash format. Then you will have to find duplicate keys and consolidate them.
https://www.postgresql.org/docs/9.4/static/datatype-json.html
Then you will have to go through and consolidate duplicate keys (wifi, free wifi, etc). Unfortunately this can't be done programatically as even if you wrote a perfect program to do this, in the future there might be a new form you did not account for like "included Wifi".

Gooddata Report Showing Weather by Store

I do have in my project model 3 datasets showing stores (DS_SITE), cities (Cidades) and weather (DS_DADOS_CLIMA) like in the image below:
datasets
And I want to see the name of the store with it's respectively weather information, but when I try select the store name to the report, it's not permitted:
report
how
There is some way to show the weather with the store name in the same report? I've changed the model and the metric several times trying to do it, but it didn't work.
Here is the metric I used in the example above (DS_DC_TEMP_MAX = weather fact):
metric
The direction of the arrow between City and Weather is what's preventing you from slicing temperature by Store.
Are you're sure about it? (as modeled, each city can have multiple weathers, each weather belongs to at most one city)?
If the direction is correct (you're probably tracking history of weathers), you'll need to lift weather to city, see explicit lifting:
https://help.gooddata.com/display/doc/Explicit+Lifting.
If you don't need to track history, just reverse the direction of the arrow between city & weather and you should be able to slice temperature by store (show them side by side).
Hope that helps.

GPS creating anchor point by trip mode and time

I was hoping for some help:
I have 200 participants, each with their own GPS file. Each GPS file has 1000s of points, one for every 15 second epoch. I have already cleaned the data through PALMS and have brought the file into arcmap. I would like to merge multiple points that share the same location and trip mode type (e.g., stationary, location number 1, see table attached). The main difference is that the merging needs to be sensitive to time (e.g., there might be 4 points at location 1 as that person visited the location on 4 separate occasions). I don't have tracking analyst, so any help would be much appreciated! The end game is that I need to create 1km anchor points based on places where the track stayed in one location for a large amount of time (e.g., a minimum of two hours, at least three times per week). Could someone suggest how I might do this?
Thanking you.
Erika
enter image description here
enter image description here
enter image description here

Get geo-locations from cities

I am trying to display a list of closest restaurants of a given city within a radius. In order to do this, I'll have to convert the city to a longitude/latitude.
When the user fills in his/her restaurant information, he/she will fill in the address. Based on that address i need to get a longitude/latitude and save that to the database.
I don't need to point this on a map. I'll be just displaying a list of all closest restaurants within the given radius to the user.
How can I do this with ASP.NET-MVC4?
Also, this project is based on Code First. And for address I have DbGeography as datatype set.
The project is kind of based on this tutorial
Edit
To avoid anyone else telling me this is not possible with ASP.NET on it's own, I am aware of that. an example with Google maps / .NET wrapper would be great.
This query itself is typically done in the database back-end because the program is the consumer of the data not the keeper of the data. You will have a table of restaurants, possibly for many cities, each restaurant having a latitude and longitude. You create a geospatial index on the table, which performs a tesselation for performance; you configure the tesselation parameters. You must determine the latitude/longitude of your restaurant-seeker's location. Your command object would feed that data to a stored procedure, along with the desired radius. The stored procedure would return an enumerable set of rows to your client program.
I found this .NET wrapper which fulfills my need.

Searching by Zip Code proximity - MySql

I'm having some trouble getting a search by zip code proximity query working. I've search and searched google but everything I find is either way too slow or I can't get working. Here's the issue:
I have a database with a table with all the US Zip Codes (~70,500 of them), and I have a table of several thousand stores (~10,000+), which includes their zip code. I need to be able to provide a zip code and return a list of the closest stores to that zip code, sorted by distance.
Can anyone point me to a good resource for this that they have used and can handle this much load, or share a query they've used that works and is fairly quick about it? It would be MUCH appreciated. Thanks!
You should build a table that has each zip code with an associated latitude and longitude. When someone enters a zip and a distance, you calculate the range of latitudes and longitudes that fall within it, and then select all the zip codes that fall within that bounding box. Then you select any stores that have zip codes within that set, and calculate their distance from the provided zip and sort by it. (Use the haversine formula for calculating the distance between points on a globe)
If speed is your main concern, you might want to precompute all the distances. Have a table that contains a store zip code column, the other zip code, and a distance column. You can restrict the other zip codes to zip codes within a certain distance (say 100 miles, or what have you) if you need to cut down on rows. If you don't restrict the links based on distance, you'll have a table with > 700 million rows, but you could certainly do fast lookups.