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 478x478 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?

  • Contact Environment Canada canada.ca/en/environment-climate-change/services/… you can access the radar with the feeds they provide. Terms and Conditions apply.
    – Mapperz
    Commented Jul 27, 2020 at 19:31
  • Thanks for the tip. I've already got the feed all hooked up. I can pull the data without a problem. The image I pulled was just for illustration purposes. My main concern is getting the projection converted so that it can be overlaid on Google Maps without distortion.
    – James M
    Commented Jul 27, 2020 at 21:25
  • Stumbled on part of the answer that seems to get me much closer. Looks like the extents are in meters for the gnom projection (can someone confirm?). If that's the case, with the scale i have I can use -240000 240000 240000 -240000 as the extents. That seems to line up everything VERY nicely, however it still requires some fidgeting of the upperleft/lowerright lat/lon corners to get it lined up perfectly. Is there a way I could use cs2cs to give me the lat/lon of the corners in the EPSG:3857 projection?
    – James M
    Commented Jul 28, 2020 at 15:55
  • Just learned about gdalinfo which actually spits out the coordinates of the corners of the warped images. That put it into google maps quite close. I'm thinking the remaining errors could be related to the quantization of the pixels.
    – James M
    Commented Jul 28, 2020 at 17:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.