TransWikia.com

Warping radar maps for overlay into Google Maps

Geographic Information Systems Asked on September 27, 2021

For a small project I’m looking to add various weather maps to overlay on Google Maps. I’ve can pull several maps from various sources, however I also know that they are not in the right projection to just dump into Google Maps.

Unfortunately I’m not an expert in GIS.

From what I’ve been able to read, I can assume that the images I get from the radars are Gnomonic projection, and I can get a reasonably accurate Latitude and Longitude of they centre pixel of the map. The scale of the map (in terms of distance for each concentric circle) is also published.

So far I’ve pieced together that I need to use goal-translate and gdalwarp to first locate the image, and then warp it into the EPSG:3857 projection that Google Maps uses.

I read someone else’s question and the answers in:

Convert gnomonic projection to Mercator

Form there I see the steps as:

gdal_translate -a_srs "+proj=gnom +lat_0=[Centre Lat] +lon_0=[Centre Lon]" -a_ullr [EXTENTS] infile.png translated.png

to actually locate the image with a projection, and from there I can use

gdalwarp -overwrite -s_srs "+proj=gnom +lat_0=[Centre Lat] +lon_0=[Centre Lon]" -t_srs EPSG:3857 translated.png warped.png

My issue comes from that while I understand the basics of what I’m doing, I’m clueless as to what to use in the [EXTENTS]. I understand that they represent the coordinate edges of the image, but I don’t know what units they are or how to get them.

I see that the person asking the question referenced cs2cs which looks useful and I can get information out of it, however I’m unsure of what values to put into it to get what I want.

To provide a concrete example:

I can fetch a radar image from Environment Canada.

XSM Strathmore Radar

From there I crop out the border and scale to the side, and get an image that is 478×478 px. Form the published data I know that the centre pixel is at -113.3881 51.0264, and that the scale is 1 px/km. Meaning that the mid points of the edges of the image are 239km from the centre.

From here I am reasonably sure that I need to go through gdal_translate to first locate the image, but I’m not sure what to use for extents. I think cs2cs could help me, but I’m not sure what to provide it for the coordinates.

Can I generate these extents from the knowledge that the edges are 283km from the centre? (at least in the mid points, I know that doesn’t apply to the corners)

Am I going down the correct rabbit hole at all?

Ultimately I would love to generate a pipeline that takes in:

  • The image
  • The lat/lon of the centre of the image
  • The scale in km/px of the image

Warp the image to be suitable to display on Google Maps, preferably with the pipeline telling me what the lat/lon extents I need to use for Google Maps are.

Could anyone nudge me in the right direction?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP