Add support for pasting GeoJSON links#996
Merged
yushan-mu merged 1 commit intoMaps4HTML:mainfrom Dec 6, 2024
Merged
Conversation
prushforth
reviewed
Oct 10, 2024
AliyanH
reviewed
Oct 11, 2024
prushforth
reviewed
Oct 11, 2024
src/mapml/utils/Util.js
Outdated
| try { | ||
| mapEl.geojson2mapml(JSON.parse(textContent)); | ||
| } catch { | ||
| console.log('Invalid link!'); |
Member
There was a problem hiding this comment.
I think thIS error message should be more along the lines of "Error parsing GeoJSON from:" + URL . It can be hard to figure out what's gone wrong, but if we say what we were trying to do, sometimes it makes it a bit easier to understand.
prushforth
reviewed
Oct 11, 2024
src/mapml/utils/Util.js
Outdated
| mapEl.removeChild(mapEl.lastChild); | ||
| } | ||
| // garbage collect it | ||
| l = null; |
Member
There was a problem hiding this comment.
I don't believe this is necessary, since the let for l scopes it to this block. It should get collected after the block closes.
05bc425 to
bdf86e6
Compare
Member
AliyanH
requested changes
Nov 25, 2024
Member
AliyanH
left a comment
There was a problem hiding this comment.
Excellent test coverage @yushan-mu!
Just a few observations:
- Please also add test coverage for the map.test.js file as you did for mapml-viewer.test.js
- I like how you navigated server.js with the 2 geojson files, it would be good to provide meaningful names to the files so its easier for us to work with them in the future, it might be better if you rename items.json -> geojsonPoints.json and map.json -> geojsonPolygon.json
- I noticed items.json has a lot of properties, might be worth it to remove them to make the json file smaller and easier to use in the future.
Great work!
prushforth
approved these changes
Dec 6, 2024
Member
prushforth
left a comment
There was a problem hiding this comment.
Good work! Thanks! Merge when ready!
f002a24 to
0d6a5ac
Compare
Edited description, strict equality, and test timeouts allow pasting of links ending in json or geojson which may have different content type Added tests for files with (geo)json extensions Cleaned up and synched tests
0d6a5ac to
ae9a6c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes issue #992