Skip to main content

Formats

Formats classes can parse different source of data into ALKMaps Vector features. Currently, ALKMaps supports GeoJSON, KML, WKT and XML. For more details and live examples, check the Example page.

KML

KML (Keyhole Markup Language) is an XML based file format used to display geographic data within two-dimensional maps or three-dimensional Earth browsers. There are different tags serving lots of different things.

In ALKMaps, KML format reads KML data and returns an array of ALKMaps.Feature.Vector objects. A vector layer can be populated with features from a KML document by configuring the layer with an HTTP protocol that points to the KML Document and is configured with a KML format for parsing features. More details please visit KML Example.

vectorLayer = new ALKMaps.Layer.Vector("KML", {
  projection: map.displayProjection,
  strategies: [new ALKMaps.Strategy.Fixed()],
  protocol: new ALKMaps.Protocol.HTTP({
    url: "https://example.com/example.kml",
    format: new ALKMaps.Format.KML({
      extractStyles: true,
      extractAttributes: true,
      maxDepth: 2
    })
  })
});

GeoJSON

GeoJSON is a format of encoding a variety of geographic data structures. GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Geometric objects with additional properties are Feature objects. Sets of features are contained by FeatureCollection objects.

WKT

WKT (Well-Known Text format) is a text markup language for representing vector geometry object on a map.

XML

ALKMaps has a simple XML format class that can be used to read/write XML docs.

Last updated November 23, 2021.