{"id":16834876,"url":"https://github.com/dchest/onmap","last_synced_at":"2025-11-09T05:03:54.846Z","repository":{"id":57654924,"uuid":"455128720","full_name":"dchest/onmap","owner":"dchest","description":"Go package onmap puts pins on a world map image.","archived":false,"fork":false,"pushed_at":"2022-03-02T17:08:56.000Z","size":825,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-24T09:42:47.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dchest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-03T10:54:12.000Z","updated_at":"2024-07-03T16:40:49.000Z","dependencies_parsed_at":"2022-08-25T08:02:36.294Z","dependency_job_id":null,"html_url":"https://github.com/dchest/onmap","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fonmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fonmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fonmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Fonmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dchest","download_url":"https://codeload.github.com/dchest/onmap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244142354,"owners_count":20404989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T12:08:13.203Z","updated_at":"2025-11-09T05:03:54.764Z","avatar_url":"https://github.com/dchest.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"onmap\n=====\n\nGo package onmap puts pins on a world map image.\n\nThe images (mercator.jpg, pin.png and pin-shadow.png) are embedded in the package,\nno need to ship them separately.\n\nImage licensing\n---------------\n\nThe default world map used is:\n\n```\nhttps://en.wikipedia.org/wiki/File:Mercator_projection_SW.jpg\nLicense: Strebe, CC BY-SA 3.0 \u003chttps://creativecommons.org/licenses/by-sa/3.0\u003e, via Wikimedia Commons\n```\n\nPin images are created by the author of the package, licensed under this package license (MIT).\n\n\nExample\n-------\n\n```go\npackage main\n\nimport (\n    \"os\"\n    \"log\"\n    \"image/png\"\n\n    \"github.com/dchest/onmap\"\n)\n\nfunc main() {\n\tcoords := []onmap.Coord{\n\t\t{42.1, 19.1},             // Bar\n\t\t{55.755833, 37.617222},   // Moscow\n\t\t{41.9097306, 12.2558141}, // Rome\n\t\t{-31.952222, 115.858889}, // Perth\n\t\t{42.441286, 19.262892},   // Podgorica\n\t\t{38.615925, -27.226598},  // Azores\n\t\t{45.4628329, 9.1076924},  // Milano\n\t\t{43.7800607, 11.170928},  // Florence\n\t\t{37.7775, -122.416389},   // San Francisco\n\t}\n\n\tm := onmap.Pins(coords, onmap.StandardCrop)\n\tf, err := os.Create(\"out.png\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer f.Close()\n\tif err := png.Encode(f, m); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nResult (shown as webp, not png):\n\n![World map with pins, cropped](example-1.webp)\n\nJust one coordinate for San Francisco and using StandardCrop:\n\n![World map with pins, cropped](example-2.webp)\n\n\nOther projections\n-----------------\n\nYou can use a different projection by defining the following interface for it:\n\n```go\n// Projection is an interface for converting coordinates.\ntype Projection interface {\n\t// Convert converts coordinates into a point on a map.\n\tConvert(coord Coord, mapWidth, mapHeight int) image.Point\n}\n```\n\nand using `MapPinsProjection` with your own world map in that projection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Fonmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdchest%2Fonmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Fonmap/lists"}