twpayne/go-kml

Multiple placemarks

cydside opened this issue · 3 comments

Hi,
I'm wondering if adding multiple placemarks is supported from your nice lib? I haven't found any example in your documentation.
Thanks.

Yes, adding multiple placemarks is supported. There's an example in the examples directory:

https://github.com/twpayne/go-kml/blob/master/examples/hike-and-fly-route-kml/main.go#L459-L477

To see this in action, run:

go run ./examples/hike-and-fly-route-kml -race=red-bull-x-alps-2019

Note that multiple placemarks need to be in some kind of container, e.g. a kml.Folder or a top level kml.Document.

Do you mean like the following?

	return kml.Folder(
		kml.Placemark(
			kml.Point(
				kml.Coordinates(center),
			),
			kml.Style(
				iconStyle,
			),
		),
		kml.Placemark(
			kml.Point(
				kml.Coordinates(center),
			),
			kml.Style(
				iconStyle,
			),
		),
		kml.Placemark(
			kml.Point(
				kml.Coordinates(center),
			),
			kml.Style(
				iconStyle,
			),
		),
	)

Do you mean like the following?

Yes, exactly.