Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MMGIS API vector layer functions #123

Merged
merged 7 commits into from
Jan 10, 2022

Conversation

ac-61
Copy link
Contributor

@ac-61 ac-61 commented Jan 6, 2022

This removes the keepN parameter from the mmgisAPI.updateVectorLayer and creates 4 helper functions for removing existing features on vector layers. Splitting the trim functionality into separate functions solves the issue of whether or not we should include new input data when removing features.

The trimVectorLayerKeepAfterTime function removes features on a specified layer before a specified time:
window.mmgisAPI.trimVectorLayerKeepAfterTime(layerName, keepAfterTime, timePropPath)

The trimVectorLayerKeepBeforeTime function removes features on a specified layer after a specified time (i.e. this function does the opposite of trimVectorLayerKeepAfterTime:
window.mmgisAPI.trimVectorLayerKeepBeforeTime(layerName, keepAfterTime, timePropPath)

The keepLastN function retains the same functionality as the original keepN parameter in the mmgisAPI.updateVectorLayer function (i.e. removes features on a specified layer to keep the specified number of existing features):
window.mmgisAPI.keepLastN(layerName, keepLastN)

The keepLastN function is unaware of time so it will remove features based on the order the features were added to the specified vector layer.

The keepFirstN, the opposite of the keepLastN function, will remove features on a specified layer, with features removed starting from the tail end of the features list.

Copy link
Member

@tariqksoliman tariqksoliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

docs/pages/markdowns/JavaScript_API.md Outdated Show resolved Hide resolved
Copy link
Member

@tariqksoliman tariqksoliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and thanks for the changes!

@ac-61
Copy link
Contributor Author

ac-61 commented Jan 10, 2022

@tariqksoliman @jtroberts I updated the pull request to add additional functions. window.mmgisAPI.trimVectorLayer is now window.mmgisAPI. trimVectorLayerKeepAfterTime and has a matching function to trim in the opposite direction window.mmgisAPI. trimVectorLayerKeepBeforeTime. window.mmgisAPI.keepLastN remains the same and now has an extra friend, window.mmgisAPI.keepFirstN.

@tariqksoliman tariqksoliman merged commit 6e4f0e5 into development Jan 10, 2022
@ac-61 ac-61 deleted the update-vector-layer branch January 10, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants