Comments (2)
Personally I think I'd prefer a separate method, like toGeoJSON.gpxMetadata() -> metadata object
rather than putting properties on FeatureCollection. I still think that putting properties on a FeatureCollection is technically allowed but practically dangerous: as soon as you send that GeoJSON through a transformation step like Turf.js, the extra properties will be removed. They won't be accessible via most GeoJSON editors or through map libraries.
I think it just makes more sense to have a separate process to get metadata, and if people strongly want to combine that metadata with their FeatureCollection object, they can do so with { ...featureCollection, ...metadata }
.
from togeojson.
Based on: https://gis.stackexchange.com/a/415412
You can insert a Polygon feature without any coordinates and set your properties as you like:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ ] }, "properties": { "description": "This is the geometry for..." } }, { // Other features } ] }
Maybe something like this would be even more easier to store and therefore portable (also when it comes to snapshot testing):
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [ ] // eventually populated by https://www.topografix.com/GPX/1/1/#type_boundsType
},
"properties": {
"_gpxType": "metadata" // everything else related to https://www.topografix.com/GPX/1/1/#type_metadataType
"name": "...",
"desc": "...",
"author": {
"name": "...",
"email": "",
"link": {
"href": "...",
"text": "...",
"type": "...",
}
},
"copyright": {
"author": "...",
"year": "...",
"license": "..."
},
"time": "...",
"keywords": "...",
"extensions": ??
},
{
// Other features
}
]
}
Not really sure if these property names make sense:
"_gpxType": "metadata"
--> similarly to what was already done to distinguish<rte>
and<trk>
tags"extensions": ??
--> probably a more complex structure (right now, I don't remember what's the current gpx extensions specfication..)
but that's just to give you a quick idea.
Related info:
togeojson/lib/__snapshots__/index.test.ts.snap
Lines 12768 to 12811 in d395dde
Lines 181 to 191 in d395dde
👋 Raruto
from togeojson.
Related Issues (20)
- Remove swc dep?
- Add support for LinearRing outside Polygon HOT 1
- GPX conversion adds "s" character to extension names HOT 1
- TS7016: Could not find a declaration file
- KML Bounds Not Parsed HOT 3
- Unexpected link to online shop in dist/lib HOT 1
- skipEmpty option for KML HOT 1
- KMZ overlay with rotation not working correctly HOT 2
- KMZ overlays not aligning same as seen in Google Earth HOT 3
- gpxx extensions without namespace HOT 1
- Reason for not mapping all found TrackPointExtensions, and only keeping one? HOT 2
- Github sponsoring HOT 1
- gpx() and kml() types aren't symmetric HOT 2
- This should complain if the input is not valid XML or valid KML HOT 1
- Unable to use ESM import HOT 5
- Translate TCX courses to folders
- Translate GPX trk elements to Folders
- Keep KML placemarks with missing coordinates HOT 4
- Folder data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from togeojson.