-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support for pasting GeoJSON links #996
Conversation
src/mapml/utils/Util.js
Outdated
try { | ||
mapEl.geojson2mapml(JSON.parse(textContent)); | ||
} catch { | ||
console.log('Invalid link!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/mapml/utils/Util.js
Outdated
mapEl.removeChild(mapEl.lastChild); | ||
} | ||
// garbage collect it | ||
l = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
fixes issue #992