From 58c375c8bbdda159434ede03ba67975603e42d63 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 7 Sep 2016 08:16:08 -0400 Subject: [PATCH] Implementation of geojson2osm definition (#11037) * Implementation of geojson2osm defintion Many forks of this project, this definition uses the actively maintained project hosted on NPM. https://www.npmjs.com/package/geojson2osm Authors: @Ruby21 & @aaronlidman * geojson2osm fixed comments - renamed test > tests - added space after project @vvakame --- geojson2osm/geojson2osm-tests.ts | 47 ++++++++++++++++++++++++++++++++ geojson2osm/geojson2osm.d.ts | 15 ++++++++++ 2 files changed, 62 insertions(+) create mode 100644 geojson2osm/geojson2osm-tests.ts create mode 100644 geojson2osm/geojson2osm.d.ts diff --git a/geojson2osm/geojson2osm-tests.ts b/geojson2osm/geojson2osm-tests.ts new file mode 100644 index 0000000000..c7bfc05b85 --- /dev/null +++ b/geojson2osm/geojson2osm-tests.ts @@ -0,0 +1,47 @@ +/// +/// + +import { geojson2osm } from 'geojson2osm' + +const features: GeoJSON.FeatureCollection = { + type: 'FeatureCollection', + features: [{ + type: 'Feature', + properties: { + 'building:colour': '#9F8169', + 'building:levels': 21, + building: 'yes', + height: 57, + }, + geometry: { + type: 'Polygon', + coordinates: [ + [ + [ + -434.2249470949173, + -13.15996269397843, + ], + [ + -434.2249470949173, + -13.159751140560356, + ], + [ + -434.2242631316185, + -13.159751140560356, + ], + [ + -434.2242631316185, + -13.15996269397843, + ], + [ + -434.2249470949173, + -13.15996269397843, + ], + ], + ], + }, + }, + ], +} + +geojson2osm(features) diff --git a/geojson2osm/geojson2osm.d.ts b/geojson2osm/geojson2osm.d.ts new file mode 100644 index 0000000000..58393411f1 --- /dev/null +++ b/geojson2osm/geojson2osm.d.ts @@ -0,0 +1,15 @@ +// Type definitions for geojson2osm 0.0.5 +// Project: https://github.com/Rub21/geojson2osm +// Definitions by: Denis Carriere +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'geojson2osm' { + /** + * Converts GeoJSON features to OpenStreetMap XML. + * @param features Input features + * @returns OpenStreetMap XML + */ + export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any +}