UTM coordinate grid. Example of one approach.

753 views
Skip to first unread message

Joseph Elfelt

unread,
Jan 20, 2011, 1:54:43 PM1/20/11
to Google Maps JavaScript API v3
Recently I added a UTM grid to my v3 app “Gmap4”. Below is a demo and
a brief description of the approach I used.

Here is a Google Terrain map of the world showing the edges of the UTM
zones (WGS84 datum).
After you zoom in enough, then a UTM grid will appear.
To search, click Menu ==> Search
http://www.mappingsupport.com/p/gmap4.php?ll=27.717297,7.832677&t=t1&z=2&coord=utm

The lower right corner of the screen displays the UTM coordinates for
the cursor and map center.
To toggle the UTM grid, click Menu ==> UTM On/Off.

I am not using a custom map projection. Instead, the UTM grid is
simply comprised of a number of polylines.

Each grid covers an area roughly 20-30% larger than the image on the
screen. Each time the map is panned/zoomed the polylines are cleared
and then recalculated.

I am not using any of the Proj.4 libraries. Instead, my code simply
includes the essential formulas to convert back and forth between lat/
lng and UTM. Performance, at least on my ~3 year old PC, is certainly
acceptable.

One of the challenges was managing the listeners that Gmap4 uses so
that when the map was panned/zoomed for any reason (1) the old grid
was erased and (2) a new grid was drawn only once.

If you are curious about Gmap4, the homepage has examples, links to
sites using Gmap4, a detailed Help file and a bit about me.
http://www.mappingsupport.com/p/gmap4.html

Joseph - Gmap4 author
Redmond, WA

Bill Chadwick

unread,
Jan 22, 2011, 1:22:58 PM1/22/11
to google-map...@googlegroups.com
I was expecting to see grid discontinuities at the zone boundaries but I dont. Can you explain why please ?

Joseph Elfelt

unread,
Jan 22, 2011, 4:53:36 PM1/22/11
to Google Maps JavaScript API v3
Bill,

I do not know how to code such a thing. Are you aware of any API maps
that show UTM grid discontinuities at the zone boundaries?

By calculating the UTM grid based on the map center, I am using the
same conceptual approach used by Barry in his map:
http://maps.google.co.uk/maps?q=http://www.nearby.org.uk/google/Gridlines_utm.kml.pl&ll=53.605544,-2.351074&z=7

I certainly wish someone was paying me to code. Alas, that is not the
situation. Since I am building Gmap4 as an unpaid hobby, I try hard
to spend my time adding features that have a high amount of practical
usefulness for the least amount of my time. Thus, I decided that if
someone was going to print a map from Gmap4 and stroll across a grid
boundary, then it would be a simple matter for them to print two maps
- one for each side of the boundary line.

Question: If you were in my shoes, what technique would you consider
for adding labels to the lines?

Regards,
Joseph

Bill Chadwick

unread,
Jan 23, 2011, 5:33:19 PM1/23/11
to google-map...@googlegroups.com
For labeling see my v2 graticules here http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm.

Printed maps often show two UTM grids near a zone boundary.

Bill

Joseph Elfelt

unread,
Jan 23, 2011, 8:43:15 PM1/23/11
to Google Maps JavaScript API v3
Thanks for the label tip. I'll take a look.

Joseph

Barry Hunter

unread,
Jan 24, 2011, 10:05:15 AM1/24/11
to google-map...@googlegroups.com
On 22 January 2011 21:53, Joseph Elfelt <joseph...@gmail.com> wrote:
> Bill,
>
> I do not know how to code such a thing.  Are you aware of any API maps
> that show UTM grid discontinuities at the zone boundaries?

One attempt here:
http://geo-en.hlipp.de/gmmap.php

(you will need to login thou to see the map - its still a work in
progress by the developer. To be honest I havent been following that
closely what doing)


>
> By calculating the UTM grid based on the map center, I am using the
> same conceptual approach used by Barry in his map:
> http://maps.google.co.uk/maps?q=http://www.nearby.org.uk/google/Gridlines_utm.kml.pl&ll=53.605544,-2.351074&z=7

Yes - I also took the easy approach, and only attempted to plot one
zone at a time - even if it extends over the formal boundary :)

>
> I certainly wish someone was paying me to code.  Alas, that is not the
> situation.  Since I am building Gmap4 as an unpaid hobby, I try hard
> to spend my time adding features that have a high amount of practical
> usefulness for the least amount of my time.

Dito :)

Joseph Elfelt

unread,
Jan 24, 2011, 1:08:49 PM1/24/11
to Google Maps JavaScript API v3
Barry,

I used your map to verify mine.
I was certainly glad to see that the maps agreed when I zoomed in on
satellite view.

Joseph
Reply all
Reply to author
Forward
0 new messages