Python tool to get an outline map of counties/states given the bounding coordinates? - gis

I am looking for a python tool that gives me the county and/or state boundaries in an image format if I provide the 4 corners in lat/lon coordinates. I plan to overlay some satellite images on these.
I briefly dabbled with geopandas and I could get a map of North America, but having something more zoomed in would be better.
Thanks.

Related

Can I highlight specific rivers with Mapbox?

Is it possible to highlight rivers in Mapbox?
I would like to look at the world and see a list of specific rivers standing out as if highlighted with a yellow marker on a paper map. As I zoom in, the highlights would get more precise and ultimately coincide with the actual geometry of the rivers, or at least follow a line equidistant to their banks…
Is this at all possible?
I understand I can draw anything I want at specific geographic coordinates, but I can't figure out how to extract the river geometry from Mapbox to compute the paths for my highlighter strokes…
Or perhaps this kind of thing would be easier with another provider? How do people usually handle this kind of thing?
As far as I know there is not a way to highlight specific rivers in Mapbox's water related layers by an attribute like name. However, if you are looking to filter features based on size/prominence it is possible to filter features using the "class" or "type" property on the Mapbox waterway layer. This will at least allow you to filter/style features based on their type (i.e. river, stream, canal, etc...).
An alternative approach would be to pull together spatial data outside of the Mapbox platform and then bring it into Mapbox as your own tilset or dataset. I have done this before using the National Hydrography Dataset (this is just for the US) when I wanted to highlight specific rivers (i.e. only show the Rio Grande, Arkansas, and Colorado Rivers). I brought the NHD into my desktop GIS application (QGIS), filtered the features to just those rivers, exported the filtered features as GeoJSON and then uploaded to Mapbox and did all the desired styling in Mapbox Studio.
Hope this helps! I have been writing a series of guides for Mapbox that you might be interested in too. Here are some links:
The Mapbox Developer's Handbook
A Complete Guide to Sources and Layers in React and Mapbox GL JS
Here's something you can try:
Use the waterway line layer in the Mapbox Streets vector tileset and set a filter to show only the river feature type. This will show all rivers at low zoom levels, but because this is a line layer, it will not show the rivers' widths at high (close to the ground) zoom levels. Set the layer to 0 opacity at higher zoom levels so it disappears.
At higher zoom levels, you can use the water polygon layer in the Mapbox Streets vector tileset, but it includes oceans, rivers, lakes, ponds, reservoirs, and fountains all smashed into a simple polygon layer of undifferentiated, merged shapes:
there is no way to filter out or highlight specific water bodies or a partial subset of them.
If you want to isolate one specific waterway (like only the Rio Grande), you will need to import that data yourself as #tylerben suggests.
If you feel adventurous, you could try using mask in Turf.js to hide features in the water layer that are more than, say, ten miles from the centerline of a river from the waterway layer.
You can learn more about Mapbox map data in the core tilesets documentation.

How to detect water on google maps

Is it possible to determine if a gps point is in water or near(not including elevation) . From what I have seen it doesn't seem possible. I had an idea of somehow getting the gps fence of water bodies and checking if the point lays in the fence. Sounds good but I can't find gps coordinate fences. If any one have any other ideas or a place to get those fences it would be great.
You can get the GPS fence for water from OpenStreetMap.
Then you do a point in polygon operation, optionally you put all polygons in
a spatial search structure, like a quad tree, for a fast polygon search nearby the lat,lon point.
You can start here. and later read more how to identify water in OpenStreetMap
A solution that works on small areas of waters, worldwide, would use much storage space If you concentrate on some countries this should work.
I found that the article is a very interesting approach.
Using google static maps to draw just some pixels around your coordinates, and then check whether its blue or not blue.
You can set a custom unique colour for "water" as a parameter to the google static map, which makes it easy for you to determine if it matches water or not

What is a coordinate reference system in GIS? How is it different from a projection system?

We hear a lot about CRS in GIS. I am working with QGIS and whenever I add a layer I need to specify the CRS but what I am confused about what exactly is a CRS and how is it different projection system. Why do countries have their own CRS and how is it determined?
If I understood the question correctly, most APIs use the WGS84 format to specify geographical coordinates, which is briefly explained in this Wikipedia article. Basically, the coordiantes are polar coordinates referring to an ellipsoid whose center is located at earth's center of gravity.
The earth is a sphere, and not a completely round one. However we would still like it as if it was flat to make proper maps and make measurements.
For example, using WGS84 on a map of Norway would make it look horribly distorted.
that is why different regions have their own projections for their own cartographic needs.
I found a good definition of a CRS here. For al intends and purposes it is the same as its projection.

Google Maps coloured overlay/polygon that only applies to water

I need to plot some coastal areas that are are easily defined in English (eg "water in the bay north of latitude X"), but are highly complex polygons because of the shoreline.
Do I have to plot the the entire (relevant) section of shoreline, or is there a way to draw a rectangle that only colours the water (and has no effect on land)?
The maps drawing tools have no knowledge of the terrain type. The tiles that show up are just background images that Google has generated from various data sources: there isn't data attached to them by the time you use the API that says "this pixel is land" or "this pixel is water". Even so, the drawing tools of Google Maps are fairly "dumb": they just allow you to plot geometric primitives on a canvas which has a coordinate system that matches latitude/longitude.
Sadly, this means that your geometry needs to be drawn to match the shoreline if you don't want it to overlap. There are resources for this, such as the NOAA shoreline data, but it's a non-trivial amount of work to consume the data and serve it up in the map.

Mapping GPS coordinates to an image

I have attempted to map some GPS coordinates (longitude / latitude pairs) onto an image of the region of the world that they correspond to. The math was not complicated simply offsetting and then transforming the numbers with a multiplier. However this worked fine for points in Australia, but not for points in New Zealand.
The result is that the points seem to drift south near the middle of the image then slowly correct before the bottom.
Is there some extra math which needs to be taken into consideration for plotting points on a map?
Note:
during my diagnostic excercise I placed my map over google maps and noticed that my version of Australia was different to google maps, but New Zealand was the same as google maps. But the plotting for Australia works but for New Zealand does not.
Longitude/Lattitude is spherical coordinatesystem and will only work if you have a globe to show your map on. In your case you have a flat map and need to project the coordinates onto a flat surface. The maps that Google uses is created with an Mercator-like projection.
What kind of projection you want to use depends on how big area your map consist of. Most countries have their own projection that fit best for their purposes.
Those transformations are quite tricky to work out by hand if your not a mathematician but there are good libraries for transformations like Dotspatial and GDal.