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 ¶
- type Option
- type Padding
- type SVG
- func (svg *SVG) AddFeature(f *geojson.Feature) error
- func (svg *SVG) AddFeatureCollection(fc *geojson.FeatureCollection) error
- func (svg *SVG) AddFeatureCollectionString(fcs string) error
- func (svg *SVG) AddFeatureString(fs string) error
- func (svg *SVG) AddGeometry(g *geojson.Geometry) error
- func (svg *SVG) AddGeometryString(gs string) error
- func (svg *SVG) Draw(width, height float64, opts ...Option) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*SVG)
An Option represents a single SVG option.
func UseProperties ¶
UseProperties configures which geojson properties should be copied to the resulting SVG element.
func WithAttribute ¶
WithAttribute adds the key value pair as attribute to the resulting SVG root element.
func WithAttributes ¶
WithAttributes adds the map of key value pairs as attributes to the resulting SVG root element.
func WithPadding ¶
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 {
// 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 ¶
AddFeature adds a geojson feature to the svg.
func (*SVG) AddFeatureCollection ¶
func (svg *SVG) AddFeatureCollection(fc *geojson.FeatureCollection) error
AddFeatureCollection adds a geojson featurecollection to the svg.
func (*SVG) AddFeatureCollectionString ¶
AddFeatureCollection adds a geojson featurecollection to the svg.
func (*SVG) AddFeatureString ¶
AddFeature adds a geojson feature to the svg.
func (*SVG) AddGeometry ¶
AddGeometry adds a geojson geometry to the svg.
func (*SVG) AddGeometryString ¶
AddGeometry adds a geojson geometry to the svg.