diff --git a/docs/assets/search.js b/docs/assets/search.js index 7edbff6..7c3a862 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = JSON.parse("{\"kinds\":{\"64\":\"Function\",\"256\":\"Interface\",\"1024\":\"Property\",\"65536\":\"Type literal\",\"4194304\":\"Type alias\"},\"rows\":[{\"id\":0,\"kind\":64,\"name\":\"gpx\",\"url\":\"modules.html#gpx\",\"classes\":\"tsd-kind-function\"},{\"id\":1,\"kind\":64,\"name\":\"gpxGen\",\"url\":\"modules.html#gpxGen\",\"classes\":\"tsd-kind-function\"},{\"id\":2,\"kind\":64,\"name\":\"tcx\",\"url\":\"modules.html#tcx\",\"classes\":\"tsd-kind-function\"},{\"id\":3,\"kind\":64,\"name\":\"tcxGen\",\"url\":\"modules.html#tcxGen\",\"classes\":\"tsd-kind-function\"},{\"id\":4,\"kind\":4194304,\"name\":\"F\",\"url\":\"modules.html#F\",\"classes\":\"tsd-kind-type-alias\"},{\"id\":5,\"kind\":256,\"name\":\"Root\",\"url\":\"interfaces/Root.html\",\"classes\":\"tsd-kind-interface\"},{\"id\":6,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/Root.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Root\"},{\"id\":7,\"kind\":1024,\"name\":\"children\",\"url\":\"interfaces/Root.html#children\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Root\"},{\"id\":8,\"kind\":256,\"name\":\"Folder\",\"url\":\"interfaces/Folder.html\",\"classes\":\"tsd-kind-interface\"},{\"id\":9,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/Folder.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":10,\"kind\":1024,\"name\":\"meta\",\"url\":\"interfaces/Folder.html#meta\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":11,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Folder.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":12,\"kind\":1024,\"name\":\"children\",\"url\":\"interfaces/Folder.html#children\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":13,\"kind\":64,\"name\":\"kml\",\"url\":\"modules.html#kml\",\"classes\":\"tsd-kind-function\"},{\"id\":14,\"kind\":64,\"name\":\"kmlWithFolders\",\"url\":\"modules.html#kmlWithFolders\",\"classes\":\"tsd-kind-function\"},{\"id\":15,\"kind\":64,\"name\":\"kmlGen\",\"url\":\"modules.html#kmlGen\",\"classes\":\"tsd-kind-function\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"parent\"],\"fieldVectors\":[[\"name/0\",[0,24.277]],[\"parent/0\",[]],[\"name/1\",[1,24.277]],[\"parent/1\",[]],[\"name/2\",[2,24.277]],[\"parent/2\",[]],[\"name/3\",[3,24.277]],[\"parent/3\",[]],[\"name/4\",[4,24.277]],[\"parent/4\",[]],[\"name/5\",[5,15.805]],[\"parent/5\",[]],[\"name/6\",[6,19.169]],[\"parent/6\",[5,0.94]],[\"name/7\",[7,19.169]],[\"parent/7\",[5,0.94]],[\"name/8\",[8,11.285]],[\"parent/8\",[]],[\"name/9\",[6,19.169]],[\"parent/9\",[8,0.671]],[\"name/10\",[9,24.277]],[\"parent/10\",[8,0.671]],[\"name/11\",[10,24.277]],[\"parent/11\",[8,0.671]],[\"name/12\",[7,19.169]],[\"parent/12\",[8,0.671]],[\"name/13\",[11,24.277]],[\"parent/13\",[]],[\"name/14\",[12,24.277]],[\"parent/14\",[]],[\"name/15\",[13,24.277]],[\"parent/15\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":10,\"name\":{\"11\":{}},\"parent\":{}}],[\"children\",{\"_index\":7,\"name\":{\"7\":{},\"12\":{}},\"parent\":{}}],[\"f\",{\"_index\":4,\"name\":{\"4\":{}},\"parent\":{}}],[\"folder\",{\"_index\":8,\"name\":{\"8\":{}},\"parent\":{\"9\":{},\"10\":{},\"11\":{},\"12\":{}}}],[\"gpx\",{\"_index\":0,\"name\":{\"0\":{}},\"parent\":{}}],[\"gpxgen\",{\"_index\":1,\"name\":{\"1\":{}},\"parent\":{}}],[\"kml\",{\"_index\":11,\"name\":{\"13\":{}},\"parent\":{}}],[\"kmlgen\",{\"_index\":13,\"name\":{\"15\":{}},\"parent\":{}}],[\"kmlwithfolders\",{\"_index\":12,\"name\":{\"14\":{}},\"parent\":{}}],[\"meta\",{\"_index\":9,\"name\":{\"10\":{}},\"parent\":{}}],[\"root\",{\"_index\":5,\"name\":{\"5\":{}},\"parent\":{\"6\":{},\"7\":{}}}],[\"tcx\",{\"_index\":2,\"name\":{\"2\":{}},\"parent\":{}}],[\"tcxgen\",{\"_index\":3,\"name\":{\"3\":{}},\"parent\":{}}],[\"type\",{\"_index\":6,\"name\":{\"6\":{},\"9\":{}},\"parent\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file +window.searchData = JSON.parse("{\"kinds\":{\"64\":\"Function\",\"256\":\"Interface\",\"1024\":\"Property\",\"65536\":\"Type literal\",\"4194304\":\"Type alias\"},\"rows\":[{\"id\":0,\"kind\":64,\"name\":\"gpx\",\"url\":\"modules.html#gpx\",\"classes\":\"tsd-kind-function\"},{\"id\":1,\"kind\":64,\"name\":\"gpxGen\",\"url\":\"modules.html#gpxGen\",\"classes\":\"tsd-kind-function\"},{\"id\":2,\"kind\":64,\"name\":\"tcx\",\"url\":\"modules.html#tcx\",\"classes\":\"tsd-kind-function\"},{\"id\":3,\"kind\":64,\"name\":\"tcxGen\",\"url\":\"modules.html#tcxGen\",\"classes\":\"tsd-kind-function\"},{\"id\":4,\"kind\":4194304,\"name\":\"F\",\"url\":\"modules.html#F\",\"classes\":\"tsd-kind-type-alias\"},{\"id\":5,\"kind\":256,\"name\":\"Root\",\"url\":\"interfaces/Root.html\",\"classes\":\"tsd-kind-interface\"},{\"id\":6,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/Root.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Root\"},{\"id\":7,\"kind\":1024,\"name\":\"children\",\"url\":\"interfaces/Root.html#children\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Root\"},{\"id\":8,\"kind\":256,\"name\":\"Folder\",\"url\":\"interfaces/Folder.html\",\"classes\":\"tsd-kind-interface\"},{\"id\":9,\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/Folder.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":10,\"kind\":1024,\"name\":\"meta\",\"url\":\"interfaces/Folder.html#meta\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":11,\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Folder.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":12,\"kind\":1024,\"name\":\"children\",\"url\":\"interfaces/Folder.html#children\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Folder\"},{\"id\":13,\"kind\":64,\"name\":\"kml\",\"url\":\"modules.html#kml\",\"classes\":\"tsd-kind-function\"},{\"id\":14,\"kind\":64,\"name\":\"kmlWithFolders\",\"url\":\"modules.html#kmlWithFolders\",\"classes\":\"tsd-kind-function\"},{\"id\":15,\"kind\":64,\"name\":\"kmlGen\",\"url\":\"modules.html#kmlGen\",\"classes\":\"tsd-kind-function\"},{\"id\":16,\"kind\":256,\"name\":\"KMLOptions\",\"url\":\"interfaces/KMLOptions.html\",\"classes\":\"tsd-kind-interface\"},{\"id\":17,\"kind\":1024,\"name\":\"skipNullGeometry\",\"url\":\"interfaces/KMLOptions.html#skipNullGeometry\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"KMLOptions\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"parent\"],\"fieldVectors\":[[\"name/0\",[0,25.39]],[\"parent/0\",[]],[\"name/1\",[1,25.39]],[\"parent/1\",[]],[\"name/2\",[2,25.39]],[\"parent/2\",[]],[\"name/3\",[3,25.39]],[\"parent/3\",[]],[\"name/4\",[4,25.39]],[\"parent/4\",[]],[\"name/5\",[5,16.917]],[\"parent/5\",[]],[\"name/6\",[6,20.281]],[\"parent/6\",[5,1.03]],[\"name/7\",[7,20.281]],[\"parent/7\",[5,1.03]],[\"name/8\",[8,12.397]],[\"parent/8\",[]],[\"name/9\",[6,20.281]],[\"parent/9\",[8,0.755]],[\"name/10\",[9,25.39]],[\"parent/10\",[8,0.755]],[\"name/11\",[10,25.39]],[\"parent/11\",[8,0.755]],[\"name/12\",[7,20.281]],[\"parent/12\",[8,0.755]],[\"name/13\",[11,25.39]],[\"parent/13\",[]],[\"name/14\",[12,25.39]],[\"parent/14\",[]],[\"name/15\",[13,25.39]],[\"parent/15\",[]],[\"name/16\",[14,20.281]],[\"parent/16\",[]],[\"name/17\",[15,25.39]],[\"parent/17\",[14,1.235]]],\"invertedIndex\":[[\"__type\",{\"_index\":10,\"name\":{\"11\":{}},\"parent\":{}}],[\"children\",{\"_index\":7,\"name\":{\"7\":{},\"12\":{}},\"parent\":{}}],[\"f\",{\"_index\":4,\"name\":{\"4\":{}},\"parent\":{}}],[\"folder\",{\"_index\":8,\"name\":{\"8\":{}},\"parent\":{\"9\":{},\"10\":{},\"11\":{},\"12\":{}}}],[\"gpx\",{\"_index\":0,\"name\":{\"0\":{}},\"parent\":{}}],[\"gpxgen\",{\"_index\":1,\"name\":{\"1\":{}},\"parent\":{}}],[\"kml\",{\"_index\":11,\"name\":{\"13\":{}},\"parent\":{}}],[\"kmlgen\",{\"_index\":13,\"name\":{\"15\":{}},\"parent\":{}}],[\"kmloptions\",{\"_index\":14,\"name\":{\"16\":{}},\"parent\":{\"17\":{}}}],[\"kmlwithfolders\",{\"_index\":12,\"name\":{\"14\":{}},\"parent\":{}}],[\"meta\",{\"_index\":9,\"name\":{\"10\":{}},\"parent\":{}}],[\"root\",{\"_index\":5,\"name\":{\"5\":{}},\"parent\":{\"6\":{},\"7\":{}}}],[\"skipnullgeometry\",{\"_index\":15,\"name\":{\"17\":{}},\"parent\":{}}],[\"tcx\",{\"_index\":2,\"name\":{\"2\":{}},\"parent\":{}}],[\"tcxgen\",{\"_index\":3,\"name\":{\"3\":{}},\"parent\":{}}],[\"type\",{\"_index\":6,\"name\":{\"6\":{},\"9\":{}},\"parent\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index a72219d..d7be54f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,4 +168,4 @@

Protips:


Maintainability Test Coverage

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/Folder.html b/docs/interfaces/Folder.html index 04c20a0..b53f878 100644 --- a/docs/interfaces/Folder.html +++ b/docs/interfaces/Folder.html @@ -2,7 +2,7 @@

A folder including metadata. Folders may contain other folders or features, or nothing at all.

-

Hierarchy

Index

Properties

children: (F | Folder)[]
meta: {}
+

Hierarchy

Index

Properties

children: (F | Folder)[]
meta: {}

Standard values:

  • "name",
  • @@ -13,4 +13,4 @@
  • "phoneNumber",
  • "visibility",
-

Type declaration

  • [key: string]: unknown
type: "folder"

Generated using TypeDoc

\ No newline at end of file +

Type declaration

type: "folder"

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/KMLOptions.html b/docs/interfaces/KMLOptions.html new file mode 100644 index 0000000..737a480 --- /dev/null +++ b/docs/interfaces/KMLOptions.html @@ -0,0 +1,13 @@ +KMLOptions | @tmcw/togeojson
Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface KMLOptions

+

Options to customize KML output.

+

The only option currently +is skipNullGeometry. Both the KML and GeoJSON formats support +the idea of features that don't have geometries: in KML, +this is a Placemark without a Point, etc element, and in GeoJSON +it's a geometry member with a value of null.

+

toGeoJSON, by default, translates null geometries in KML to +null geometries in GeoJSON. For systems that use GeoJSON but +don't support null geometries, you can specify skipNullGeometry +to omit these features entirely and only include +features that have a geometry defined.

+

Hierarchy

  • KMLOptions

Index

Properties

skipNullGeometry?: boolean

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/Root.html b/docs/interfaces/Root.html index d0abcd1..2e264b7 100644 --- a/docs/interfaces/Root.html +++ b/docs/interfaces/Root.html @@ -1,4 +1,4 @@ Root | @tmcw/togeojson
Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Root

A nested folder structure, represented as a tree with folders and features.

-

Hierarchy

  • Root

Index

Properties

Properties

children: (F | Folder)[]
type: "root"

Generated using TypeDoc

\ No newline at end of file +

Hierarchy

Index

Properties

Properties

children: (F | Folder)[]
type: "root"

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index d3f1145..7a6b083 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,4 +1,4 @@ -@tmcw/togeojson
Options
All
  • Public
  • Public/Protected
  • All
Menu

@tmcw/togeojson

Index

Type Aliases

F: Feature<Geometry | null>

Functions

  • gpx(node: Document): FeatureCollection
  • +@tmcw/togeojson
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    @tmcw/togeojson

    Index

    Type Aliases

    F: Feature<Geometry | null>

    Functions

    • gpx(node: Document): FeatureCollection
    • Convert a GPX document to GeoJSON. The first argument, doc, must be a GPX document as an XML DOM - not as a string. You can get this using jQuery's default .ajax function or using a bare XMLHttpRequest with the .response property @@ -6,11 +6,11 @@

      The output is a JavaScript object of GeoJSON data, same as .kml outputs, with the addition of a _gpxType property on each LineString feature that indicates whether the feature was encoded as a route (rte) or track (trk) in the GPX document.

      -

      Parameters

      • node: Document

      Returns FeatureCollection

    • gpxGen(node: Document): Generator<Feature>
    • +

      Parameters

      • node: Document

      Returns FeatureCollection

    • gpxGen(node: Document): Generator<Feature>
    • Convert GPX to GeoJSON incrementally, returning a Generator that yields output feature by feature.

      -

      Parameters

      • node: Document

      Returns Generator<Feature>

    • kml(node: Document): FeatureCollection<Geometry | null>
    • +

      Parameters

      • node: Document

      Returns Generator<Feature>

    • kml(node: Document, options?: KMLOptions): FeatureCollection<Geometry | null>
    • Convert a KML document to GeoJSON. The first argument, doc, must be a KML document as an XML DOM - not as a string. You can get this using jQuery's default .ajax function or using a bare XMLHttpRequest with the .response property @@ -18,11 +18,11 @@

      The output is a JavaScript object of GeoJSON data. You can convert it to a string with JSON.stringify or use it directly in libraries.

      -

      Parameters

      • node: Document

      Returns FeatureCollection<Geometry | null>

    • kmlGen(node: Document): Generator<F>
    • +

      Parameters

      Returns FeatureCollection<Geometry | null>

    • kmlGen(node: Document, options?: KMLOptions): Generator<F>
    • Convert KML to GeoJSON incrementally, returning a Generator that yields output feature by feature.

      -

      Parameters

      • node: Document

      Returns Generator<F>

    • kmlWithFolders(node: Document): Root
    • Yield a nested tree with KML folder structure

      This generates a tree with the given structure:

      {
      "type": "root",
      "children": [
      {
      "type": "folder",
      "meta": {
      "name": "Test"
      },
      "children": [
      // ...features and folders
      ]
      }
      // ...features
      ]
      } @@ -40,11 +40,11 @@

      GroundOverlay

      property. Ground overlays will need to be displayed with a separate method to other features, depending on which map framework you're using.

      -

      Parameters

      • node: Document

      Returns Root

    • tcx(node: Document): FeatureCollection
    • tcx(node: Document): FeatureCollection
    • Convert a TCX document to GeoJSON. The first argument, doc, must be a TCX document as an XML DOM - not as a string.

      -

      Parameters

      • node: Document

      Returns FeatureCollection

    • tcxGen(node: Document): Generator<Feature>
    • +

      Parameters

      • node: Document

      Returns FeatureCollection

    • tcxGen(node: Document): Generator<Feature>
    • Incrementally convert a TCX document to GeoJSON. The first argument, doc, must be a TCX document as an XML DOM - not as a string.

      -

      Parameters

      • node: Document

      Returns Generator<Feature>

    Legend

    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    • node: Document

    Returns Generator<Feature>

Generated using TypeDoc

\ No newline at end of file diff --git a/lib/index.ts b/lib/index.ts index c1cad03..9d5cd30 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,4 +1,4 @@ export { gpx, gpxGen } from "./gpx"; export { tcx, tcxGen } from "./tcx"; export { F } from "./shared"; -export { Root, Folder, kml, kmlWithFolders, kmlGen } from "./kml"; +export { Root, Folder, kml, kmlWithFolders, kmlGen, KMLOptions } from "./kml";