Any better way to handle time for linestring in geojson files?
See original GitHub issueAt the moment I figured out, we can add time as a property for point and polygons. Works great but for line strings we need to add times as many times as coordinates or else just the last point is displayed. This is cumbersome. Does anyone have a different approach?
Point Sample
"type":"FeatureCollection",
"crs":{
"type":"name",
"properties":{
"name":"urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features":[
{
"type":"Feature",
"properties":{
"ID":1,
"Category":null,
"Type":"Test",
"Date":"20180101000000",
"time":"2015-03-08T00:00:00.000Z"
}
}
]
}
Linestring Sample
"type":"FeatureCollection",
"crs":{
"type":"name",
"properties":{
"name":"urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features":[
{
"type":"Feature",
"properties":{
"ID":1,
"Category":null,
"Type":"Bike",
"Date":"20181201000000",
"time":"2017-09-08T00:00:00.000Z",
"times":[
"2017-03-08T00:00:00.000Z",
"2018-03-08T00:00:00.000Z",
"2019-03-08T00:00:00.000Z",
"2020-03-08T00:00:00.000Z",
"2021-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2019-03-08T00:00:00.000Z",
"2020-03-08T00:00:00.000Z",
"2020-04-08T00:00:00.000Z",
"2020-06-08T00:00:00.000Z",
"2022-9-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z",
"2022-03-08T00:00:00.000Z"
]
},
"geometry":{
"type":"LineString",
"coordinates":[
[
144.66611709854402,
-37.900577963091273
],
[
144.66602796949803,
-37.900442408518742
],
[
144.66590379717303,
-37.900365586305668
],
[
144.66576112853602,
-37.900303624206259
],
[
144.66554465611304,
-37.900240128116373
],
[
144.66534036753902,
-37.900183918893688
],
[
144.66518118427402,
-37.90013647945878
],
[
144.66505050724803,
-37.900103552184376
],
[
144.66491364621902,
-37.900062765214692
],
[
144.66482396021803,
-37.900032461346385
],
[
144.66469208573804,
-37.8999824054616
],
[
144.66459597229104,
-37.899951376409859
],
[
144.66444721577102,
-37.89989803638057
],
[
144.66430606349104,
-37.899865072139342
],
[
144.66412351145203,
-37.89982319766478
],
[
144.66386013259702,
-37.89946918323816
],
[
144.66362211228403,
-37.899210914901786
],
[
144.66348071296702,
-37.89899193259587
],
[
144.66323273213405,
-37.898545654643044
]
]
}
}
]
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Representing Time in GeoJSON? - GIS Stack Exchange
In my opinion the "right" way would be using properties unless you consider your timestamps to be coordinates in time ...
Read more >More than you ever wanted to know about GeoJSON
LineString and Polygon geometries contain coordinates in an order: lines go in a certain direction, and polygon rings do too. The direction of ......
Read more >more efficient way to search through geoJson in double for ...
I would like to find the Linestrings that starts or ends coordinates equals point coordinates. I mean, I need first iterate over point...
Read more >A primer on GeoJSON standard and visualization tools
A LinearRing is a closed LineString with four or more positions. “Closed” simply means that the start and end point of the LinearRing...
Read more >Chapter 7 GeoJSON | Introduction to Web Mapping
However, there are ways to reduce GeoJSON file size by simplifying its ... the geometry can consist of one or more shapes of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve checked the code and it’s not working as you expected with one time for the whole linestring. It is generating a new linestring with the first point.
But you can create a new class to override the method
_getFeatureBetweenDates
, and return the feature without modification if its time is active. Checkout this example@bielfrontera that just worked perfectly as I expected. Thanks heaps 😃