Mapping

I was reading the state GIS’ email list, and noticed that their Civil Boundaries ArcMap has linked to it Census population counts for 1990, 2000, 2010 and 2020 for those interested in population changes for counties and localities without having to download and link the Census data

I was reading the state GIS’ email list, and noticed that their Civil Boundaries ArcMap has linked to it Census population counts for 1990, 2000, 2010 and 2020 for those interested in population changes for counties and localities without having to download and link the Census data. Get it here:

https://gisservices.its.ny.gov/arcgis/rest/services/NYS_Civil_Boundaries/FeatureServer/

NOAA’s GEOS-East Latest Image Retrieval

Earlier today I posted a Leaflet Map showing the current Satellite Image from NOAA’s GEOS-East derived product, the GeoColor. It’s nice but to look really attractive you need to increase the brightness and saturation. If you want a 1920×1080 image that looks nice that you can download, you can use this python code. This ARC GIS Image Server is relatively straightforward to work with — supply a bounding box in Web Mercator, size and a few other parameters and it will spit back the image you want.

import requests, io
from PIL import Image, ImageEnhance, ImageDraw, ImageFont
from datetime import datetime

# new york - new england
url = "https://satellitemaps.nesdis.noaa.gov/arcgis/rest/services/MERGED_GeoColor/ImageServer/exportImage/exportImage?bbox=-9011008.3905,4747656.7008,-7345292.6701,6195679.7647&size=1920%2C1080&format=jpgpng&transparent=false&bboxSR=3857&imageSR=3857&f=image"

# full usa
#url = "https://satellitemaps.nesdis.noaa.gov/arcgis/rest/services/MERGED_GeoColor/ImageServer/exportImage/exportImage?bbox=-14401959.1214%2C2974317.6446%2C-7367306.5342%2C6447616.2099&size=1920%2C1080&format=jpgpng&transparent=false&bboxSR=3857&imageSR=3857&f=image&fbclid=IwAR1HvlVi55Bd933eOhM-Cvou2JgPdKAlcp2go4f8B5pqcioAPvcJyfYT0BA"

response = requests.get(url)
image_bytes = io.BytesIO(response.content)
img = PIL.Image.open(image_bytes)

enhancer = ImageEnhance.Color(img)
img = enhancer.enhance(2.5)

enhancer = ImageEnhance.Brightness(img)
img = enhancer.enhance(1.2)


img.save('/tmp/latest_image.jpg')

Easy and Hard Map Based on Projections

When using a projected coordinate system, it turns out you can calculate distance with a very simple lambda function. Beats that ugly haversine formula you have to use with World Geodetic System 1984.

lambda xa, ya, xb, yb : math.sqrt((xb-xa)**2 + (yb-ya)**2)

Here is the equalivent with WGS 84 (written as a Lambda):

lambda xa, ya, xb, yb: 2*asin(sqrt(sin(radians(xb – xa) /2)**2 + cos(radians(xa))*cos(radians(xb))*sin(radians(yb – ya)/2)**2 )) * 3959.87433

...

Maybe I’m a bad person for saying this, but I generally just accept that there is 1610 meters in a mile and 2.6 million square meters in a square mile. #roundingworks #gosueme

Math like this will probably be a bad thing if you are aiming a missile to hit a target thousands of miles away but for ordinary life, i think it’s quite fine. I use 1610 meters a mile, because it’s easier to round up — a half mile then becomes 805 meters, a quarter mile 402.5 miles, a tenth of a mile is 161 meters. If you rounded down to 1609 meters, that math becomes a lot harder to do in your head.
 

 
How did I not know that QGIS can natively open Shapefiles in ZIP files?
 
This is the best thing since like forever.