Geo-mapping with Python - python

I am developing a program in Python 3 that uses weather data to predict plant disease risk. The weather data come from a number of weather stations dotted around the country. What I require is that a user is able to look at a map and decide which weather station "feeds" they need to subscribe to. To do this I need to be able to map the area that each weather station covers given its longitutde and latitude. I currently have about 150 weather stations covering the country.
I feel that the Shapely should be able to do this but a scan of the documentation reveals no clues given my limited experience with geo stuff.
I'd be realy grateful if someone could point me in the direction of a library that can accomplish this.


What Geographic Reference System and Datum is used for DJI Phantom 3 advance

I have spend a bit of effort trying to figure out what the geographic projection is of coordinates attached to the exif files of the photos taken on the DJI Phantom 3 advance. I assumed that it was in WGS84 with the elevation in its associated datum, but when I looked closely at the elevation values, there was a systematic offset that was closer to the NAVD88 datum (but still off).
I called DJI's tech support and was put on hold for a while, and they reported back that the it was indeed NAVD88. I am not sure I buy this answer though. The person I was talking to had no idea at first, and I had planted the term navd88 when I posed the question, and even spelled it out for him; I asked if the z was in a global ellipsoid or a local datum like navd88.
Like I said, I was on hold for a long time, so it is possible this is really the correct answer, but when I think about it, it doesn't make sense. These are flown all over the world, so why would you want a North American datum if you are flying in Tasmania for example. I suppose it is possible there is a list of local datums onboard, and it automatically applies it depending on the location, but I kind of doubt it.
I know that the onboard GPS in not very accurate, especially in the Z direction, but where I am at there is more than 13 meters difference between the WGS84 global ellipsoid and NAVD88. Knowing the datum will help strengthen my photogrammetry product.
I also went through all the DJI documentation I could find on the subject, to no avail.
Has anyone else examined this issue in detail?
I was thinking the exact same thing! Which datum is used, so propably WGS84. But yes if you are in Tasmania, that make a difference, you can have more than hundred feet diffence if you are looking at a specific waypoint. But at the end, that makes no diffence of using the "universal datum" WGS84, because when you use a point as a "RTH" point, you not entering a geodesic point (lat/long). But the drone is recording where is at according to what it's reading! The day that DJI will offer to enter a coordinated, then, exact country datum will be required.
Another "BUT".... if you are looking at your flight records, while playback your flight, at the bottom you can see you coordinates, so if you have an nicking gps, and that gps is set at WGS84 datum, do that exercise, enter you coordinated on google earth and check where it's landing. Then change gps datum to another datum, nad27 or what ever and enter again your coordinates and check again, you will be surprise of the distance difference!!
Take care!

Autonomous Driving - What API can use to get the path/directions from an origin coordinates to a destination coordinates on the global map?

I am part of an Autonomous Driving project and my task is to get the directions from an origin coordinates to a destination coordinates. I have tried to use Google Directions API but it returns data that could be useful for a human driver but not so much for an autonomous vehicle.
Google returns the directions in the form of Steps, each Step has some data which are used by a mobile app or html browser to display the directions info to assist the driver. For example:
origin coordinates: xyz.
next step coordinates : abc
distance to the next step: 123
maneuver: turn right (I can't tell the robot or the car to just "turn right" I need to be more specific)
Another problem with the Google API that I am having is that the distance between each two steps is way too long for our car's local map. The car Local Map is a grid of 30 metres square that contains the obstacles, moving objects and everything that the car sees. I also contains a Global Map next step destination which is a translation of the global map big steps. Meaning that I need smaller distances between each two steps in order to put in the local map.
My question is, Is there any other API other than google that provide more specific global directions that can be used in my case?
Are you sure you need a complicated API for your task? If you really need one, your task is much more complicated than anyone on Stackoverflow can help with besides pointing you to Nvidia's driving solution or Udacity's open source implementation. It would be helpful if you posted more details about the specifics of your task. Expecting you to come up with maneuver angles on your own sounds like you should just be using geometry.

Python Selenium infinite loop

I'm trying to study customers behavior. Basically, I have information on customer's loyalty points activities data (e.g. how many points they have earned, how many points they have used, how recent they have used/earn points etc). I'm using R to conduct this analysis
I'm just wondering how should I go about segmenting customers based on the above information? I'm trying to apply the RFM concept then use K-means to segment my customers(although I have a few more variables than just R,F,M , as i have recency,frequency and monetary on both points earn and use, as well as other ratios and metrics) . Is this a good way to do this?
Essentially I have two objectives:
1. To segment customers
2. Via segmenting customers, identify customers behavior(e.g.customers who spend all of their points before churning), provided that segmentation is the right method for such task?
Clustering <- kmeans(RFM_Values4,centers = 10)
Please enlighten me, need some guidance on the best methods to tackle such problems.
Your attempts is always less then 5 because there is no variable increment. So your loop is infinite

Administrative Levels of countries as polygons

I am trying to create a database (SQL Server) with countries and administrative levels through out the world, especially Europe.
I want to use polygon data for all the areas, and use search and get "point in polygon" results.
I've looked at different places for data, but I find it kind of difficult to extract the correct data, and use it.
My problem is I really don't know where to start.
I've looked at geonames, google maps and openstreetmap for data, and I think OSM is the best. But I don't know how to extract it.
How to extract polygon data from OSM, or another great solution.
Take a look at GADM, where you will find shapefiles (also kml, etc) for every country. Unfortunately, the admin areas are not always up-to-date, so if accuracy is vital. you will need to do some work to improve them. I also suspect (comparing GADM's UK shapes with those from the Ordnance Survey) that a certain amount of simplification has taken place, leading to 'point in polygon' errors, especially at country boundaries.
I agree that OSM is better than most, but the extraction of polygons from the OSM data has not been as straightforward as I would have hoped.

Reverse Geocoding Without Web Access

I am working on an application where one of the requirements is that I be able to perform realtime reverse geocoding operations based on GPS data. In particular, I must be able to determine the state/province to which a latitude, longitude pair maps and detect when we have moved from one state/province to another.
I have a couple ideas so far but wondered if anyone had any ideas on either of the following:
What is the best approach for tackling this problem in an efficient manner?
Where is a good place to find and what is the appropriate format for North American state/province boundaries
As a starter, here are the two main ideas I have:
Break North America into a grid with each rectangle in the grid mapping to a particular state province. Do a lookup on this table (which grows quickly the more precise you would like to be) based on the latitude and then the longitude (or vice versa).
Define polygons for each of the states and do some sort of calculation to determine in which polygon a lat/lon pair lies. I am not sure exactly how to go about this. HTML image maps come to mind as one way of defining the bounds for a state/province.
I am working in python for the interested or those that might have a nice library they would like to suggest.
To be clear... I do not have web access available to me, so using an existing reverse geocoding service is not an option at runtime
I suggest using a variant of your first idea: Use a spatial index. A spatial index is a data structure built from rectangles, mapping lat/long to the payload. In this case you will probably map rectangles to state-province pairs. An R-tree may be a good option. Here's an R-tree python package. You could detect roaming by comparing the results of consecutive searches.
I would stay away from implementing your own solution from scratch. This is a pretty big undertaking and there are already tools out there to do this. If you're looking for an open source approach (read: free), take a look at this blog post: Using PostGIS to Reverse Geocode.
I created an offline reverse geocoding module for countries:
>>> import reverse_geocode
>>> coordinates = (-37.81, 144.96), (31.76, 35.21)
[{'city': 'Melbourne', 'code': 'AU', 'country': 'Australia'},
{'city': 'Jerusalem', 'code': 'IL', 'country': 'Israel'}]
I will see if I can add data for states.
If you can get hold of state boundaries as polygons (for example, via OpenStreetMap), determining the current state is just a point-in-polygon test.
If you need address data, an offline solution would be to use Microsoft Mappoint.
You can get data for the entire united states from open street map You could then extract the data you need such as city or state locations into what ever format works best for your application. Note although data quality is good it isn't guaranteed to be completely accurate so if you need complete accuracy you may have to look somewhere else.
I have a database with all of this data and some access tools. I made mine from the census tiger data. I imagine it'd basically be an export of my database to sqlite and a bit of code translation.