• Stars
    star
    8
  • Rank 2,099,232 (Top 42 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Go project to explore the math to calculate and present data in a map using the `Web Mercator Projection`

Web Mercator Projection

Tests Go Report Card Coverage Status Go Reference

WorldMap

A Go project to explore the Math to calculate and present data in a map using the Web Mercator Projection.

To get more information about this topic, please look at the following references:

How does this project work?

In the main example project, there is a file main.go that contains the following actions available:

  • Convert a LonLat into a Point coordinates and vice versa.

  • A function to add a Red-Marker into a map image. (The coordinates must be setted manually in the code)

    The resultant image will be stored in a folder named data.

This is how the main.go will print out the information:

LonLat: {-74.92010258781309 11.045882360336755}
Point: {298.8939304168872 480.38414652354516 2}
Tile: {1 1 2}
LonLat from Point: {-74.9201025878131 11.045882360336744}

Structs definitions

  • LonLat: A location in the map using angles in degrees.
  • Point: A pixel in the map for a specific zoom or scale.
  • Tile: Represent at which (tile/block) a Point or LonLat is.

If you are curious about how the maps where built using the data in OpenStreetMap please take a look at this Gist https://gist.github.com/jorelosorio/7042bd27e4b2bb03865215d6a5607266

Tools

Development

This project contains a Dockerfile file with all required dependencies to run it using Visual Studio Code + Remote - Containers extension. However, if you want to make it run locally in your development machine, please follow the instructions below.

Install Go

Install it from https://go.dev/dl/

Install ImageMagick

Install it using the following instructions https://imagemagick.org/script/download.php

Build the executable

go build ./examples/main.go

The binary file depends on the assets folder to build the map, make sure to have it on the same directory.

Licences and assets