svg

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 10 Imported by: 4

README

go-geojson-svg

Work in progress. This is a hard fork of Fabian Prein's geojson2svg.

Documentation

Overview

Package geojson2svg provides the SVG type to convert geojson geometries, features and featurecollections into a SVG image.

See the tests for usage examples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extent

type Extent struct{ MinX, MinY, MaxX, MaxY float64 }

type Option

type Option func(*SVG)

An Option represents a single SVG option.

func UseProperties

func UseProperties(props []string) Option

UseProperties configures which geojson properties should be copied to the resulting SVG element.

func WithAttribute

func WithAttribute(k, v string) Option

WithAttribute adds the key value pair as attribute to the resulting SVG root element.

func WithAttributes

func WithAttributes(as map[string]string) Option

WithAttributes adds the map of key value pairs as attributes to the resulting SVG root element.

func WithPadding

func WithPadding(p Padding) Option

WithPadding configures the SVG to use the specified padding.

type Padding

type Padding struct{ Top, Right, Bottom, Left float64 }

Padding represents the possible padding of the SVG.

type SVG

type SVG struct {
	Mercator bool
	Extent   *Extent
	Debug    bool
	// contains filtered or unexported fields
}

SVG represents the SVG that should be created. Use the New function to create a SVG. New will handle the defaualt values.

default padding (top: 0, right: 0, bottom: 0, left: 0)

default properties (class)

default attributes ()

func New

func New() *SVG

New returns a new SVG that can be used to to draw geojson geometries, features and featurecollections.

func (*SVG) AddFeature

func (svg *SVG) AddFeature(fs string) error

AddFeature adds a geojson feature to the svg.

func (*SVG) AddFeatureCollection

func (svg *SVG) AddFeatureCollection(fcs string) error

AddFeatureCollection adds a geojson featurecollection to the svg.

func (*SVG) AddGeometry

func (svg *SVG) AddGeometry(gs string) error

AddGeometry adds a geojson geometry to the svg.

func (*SVG) Draw

func (svg *SVG) Draw(width, height float64, opts ...Option) string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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