{"versions":{"1.0.0":{"name":"@yaga/generic-geojson","version":"1.0.0","description":"Enhancement of the original GeoJSON type definition for TypeScript","main":"index.js","scripts":{"test":"tsc"},"repository":{"type":"git","url":"git+https://github.com/yagajs/generic-geojson.git"},"keywords":["geosjon","typescript","generic-definition","spatial"],"author":{"name":"Arne Schubert","email":"atd.schubert@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/yagajs/generic-geojson/issues"},"homepage":"https://github.com/yagajs/generic-geojson#readme","dependencies":{"@types/geojson":"0.0.32"},"gitHead":"9f319643a78e3bc49bd02319627be600bbde8aa0","_id":"@yaga/generic-geojson@1.0.0","_shasum":"e27e1267c70797c7e0558a6449a1faf7aa6d8056","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"anonymous","email":"atd.schubert@gmail.com"},"dist":{"shasum":"e27e1267c70797c7e0558a6449a1faf7aa6d8056","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@yaga/generic-geojson/-/generic-geojson-1.0.0.tgz","size":6732,"integrity":"sha512-s3Hjp4yN+EwnB/DHdA0v36lsJT5MesmlUh7xzpU2HGKXpIN29TjLW2c03vIHNQM0Lufn0zlJtKN5W5/Ibck8ag=="},"maintainers":[{"name":"anonymous","email":"atd.schubert@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/generic-geojson-1.0.0.tgz_1485431048245_0.06230034329928458"},"directories":{},"_cnpmcore_publish_time":"2021-12-19T20:12:34.582Z","contributors":[]}},"dist-tags":{"latest":"1.0.0"},"name":"@yaga/generic-geojson","time":{"created":"2022-01-27T01:15:46.478Z","modified":"2023-12-30T04:11:17.652Z","1.0.0":"2017-01-26T11:44:08.918Z"},"readme":"# Generic GeoJSON type definition\n\nThis is just a type definition and an enhancement of the \n[original GeoJSON type definition](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/geojson) for \n[TypeScript](http://www.typescriptlang.org/).\n\nYou can use this definition to handle [generic](https://www.typescriptlang.org/docs/handbook/generics.html)\n[properties of features](http://geojson.org/geojson-spec.html#feature-objects) in [GeoJSON](http://geojson.org/).\n\n## How to use\n\nJust install this definition with:\n\n```bash\nnpm install --save @yaga/generic-geojson\n```\n\nand import into your TypeScript source:\n\n```typescript\nimport { GenericGeoJSONFeature, GenericGeoJSONFeatureCollection } from '@yaga/generic-geojson';\n```\n\n## Background\n\nThe specification of GeoJSON allows every data type for the `properties` property.\nIn lots of use-cases you want to specify the properties to a special (generic) one.\nWith this definition you are able to do so.\n\n## Example\n\nEvery GeoJSON is compatible to the generic one with the `any` type:\n\n```typescript\n\nimport OriginalFeature = GeoJSON.Feature;\nimport GeometryObject = GeoJSON.GeometryObject;\nimport { GenericGeoJSONFeature } from '@yaga/generic-geojson';\n\nlet aFeature: OriginalFeature<GeometryObject> = {\n    type: 'Feature',\n    geometry: {\n        type: 'Point',\n        coordinates: [1, 2]\n    },\n    properties: {\n        all: 'should',\n        be: true\n    }\n};\n\n// This is valid!\nlet aGenericFeatureWithAny: GenericGeoJSONFeature<GeometryObject, any> = aFeature;\n\n```\n\nThe first generic have the same meaning like the one from the original GeoJSON definition.\nAdditionally you are able to specify the `properties` more precise with the second generic:\n\n```typescript\n\nimport GeometryObject = GeoJSON.GeometryObject;\nimport { GenericGeoJSONFeature } from '@yaga/generic-geojson';\n\ninterface TestInterface {\n    just: boolean;\n    specific: string;\n    properties?: number;\n}\n\nlet aSpecifiedFeature: GenericGeoJSONFeature<GeometryObject, TestInterface> = {\n    type: 'Feature',\n    geometry: {\n        type: 'Point',\n        coordinates: [1, 2]\n    },\n    // properties must fulfill the TestInterface!\n    properties: {\n       just: true,\n       specific: '',\n       properties: 123\n    }\n};\n\n```\n\nThe same for `FeatureCollection`s:\n\n```typescript\n\nimport GeometryObject = GeoJSON.GeometryObject;\nimport { GenericGeoJSONFeature, GenericGeoJSONFeatureCollection } from '@yaga/generic-geojson';\n\ninterface TestInterface {\n    just: boolean;\n    specific: string;\n    properties: number;\n}\n\nlet aSpecifiedFeature: GenericGeoJSONFeature<GeometryObject, TestInterface> = {\n    type: 'Feature',\n    geometry: {\n        type: 'Point',\n        coordinates: [1, 2]\n    },\n    properties: {\n       just: true,\n       specific: '',\n       properties: 123\n    }\n};\n\n// Same meaning for FeatureCollections:\nlet aSpecificFeatureCollection: GenericGeoJSONFeatureCollection<GeometryObject, TestInterface> = {\n    type: 'FeatureCollection',\n    features: [ aSpecifiedFeature ]\n}\n\n```","users":{}}