polyrhythm-project / polyrhythm-maps

2 stars 0 forks source link

change the feature property in timeline map sorting function #40

Closed lilydemet closed 1 year ago

lilydemet commented 1 year ago
          Will you change the feature property from "first_publication_year" to "premiere_date" and ensure the sorting still works?

Originally posted by @lilydemet in https://github.com/polyrhythm-project/polyrhythm-maps/issues/39#issuecomment-1518706343

craigsapp commented 1 year ago

Commit https://github.com/polyrhythm-project/polyrhythm-maps/commit/19dc4972c7a92118b89c22b57d3dc9d4d7931889 changes the slider feature to premiere_date (or more precisely a new property I create on-the-fly called premiere_year).

To do this, I converted premiere_date into premiere_year, such as "3-Jul-1897" to "1897" (There seems to be a problem with leaflet interpreting a date in the format "3-Jul-1897" which is solved by switching to premiere_year). Then I sorted the markers by the new premier_year property.

Also an important thing was to set the time variable when creating the slider, so this option was added:

timeAttribute: "premiere_year",

The former line of code near the bottom of the file (that was causing an error on the console), was probably related to this option, so I removed that code since I set the timeAttribute property higher up in the file.

There were also some http:// files being included in this https:// file, so I renamed them to https:// without problem.

Here is a demo of the slider with the premier dates sorted in chronological order (by year):

ezgif com-optimize

lilydemet commented 1 year ago

thank you for the documentation and for solving the issue! I learned a lot from this.