naturalearth

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package naturalearth fetches and reads Natural Earth's land: the outlines of the land at a scale of 1:50 million, as GeoJSON.

Natural Earth is in the public domain. Its makers ask for no credit and are glad of one: "Made with Natural Earth."

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (*celestialdata.Fixed, error)

New is the archive of the land, asked by name only. It holds the one file of the land's outlines, whatever the circle.

Types

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map is the land, as polygons, each with the box its outline lies in.

func Read

func Read(file io.Reader) (*Map, error)

Read is the land in a Natural Earth GeoJSON file. It reads polygons and multipolygons, and refuses any other shape and a polygon with no outline.

func (*Map) Holds

func (land *Map) Holds(lon, lat float64) bool

Holds is whether a place, by longitude and latitude in degrees, is on land: inside a piece's outline an odd number of times, counting its holes. Rings are taken as drawn on a plain longitude and latitude grid.

func (*Map) Polygons

func (land *Map) Polygons() []Polygon

Polygons are the land's pieces.

type Polygon

type Polygon [][][pair]float64

Polygon is one piece of land: its outline first, then any holes in it. Each ring is longitude and latitude pairs in degrees.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL