A package to translate geojson geometries to GML 3.2.1.
pnpm
pnpm add geojson-to-gml-3
npm
npm install geojson-to-gml-3
yarn
yarn add geojson-to-gml-3
import type { Geometry } from 'geojson';
import gml from 'geojson-to-gml-3';
import { it, expect } from 'vitest';
it('can convert any geometry to GML', () => {
const nullIsland: Geometry = {
type: 'Point',
coordinates: [0, 0],
};
// prettier-ignore
expect(gml(nullIsland)()).toBe(''
+ `<gml:Point>`
+ `<gml:pos>`
+ `0 0`
+ `</gml:pos>`
+ `</gml:Point>`
);
});
import type { LineString } from 'geojson';
import { lineString } from 'geojson-to-gml-3';
import { it, expect } from 'vitest';
it('supports tree-shaking for slimmer builds', () => {
const line: LineString = {
type: 'LineString',
coordinates: [
[0, 0],
[1, 1],
],
};
expect(lineString(line)()).toBe(''
+ `<gml:LineString>`
+ `<gml:posList>`
+ `0 0 1 1`
+ `</gml:posList>`
+ `</gml:LineString>`
);
});
geojson-to-gml-3
is free for noncommercial use or commercial use for a period of 30 days. For more details, see the license.
Geography Markup Language (GML) is an OGC Standard.
More information may be found at http://www.opengeospatial.org/standards/gml
The most current schema are available at http://schemas.opengis.net/ .
Policies, Procedures, Terms, and Conditions of OGC(r) are available at http://www.opengeospatial.org/ogc/legal/ .
OGC and OpenGIS are registered trademarks of Open Geospatial Consortium.