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

Integrate Support for GeoJSON #707

Merged
merged 12 commits into from
Jan 17, 2023
Merged

Conversation

AliyanH
Copy link
Member

@AliyanH AliyanH commented Dec 13, 2022

Closes #706

@AliyanH AliyanH marked this pull request as ready for review December 19, 2022 17:28
@prushforth
Copy link
Member

prushforth commented Dec 21, 2022

Would it be possible to calculate the layer extent as we process the feature geometries? i.e., since we have to process each and every coordinate in the json, we could keep a running min / max and set that via a <map-meta> at the end of the process? It needn't be inserted in the <map-head> I believe it will be looked for whereever it occurs, which could be at the end of the document. Uncertain on this last point. Perhaps it would be expensive to re-write the whole document.

@AliyanH
Copy link
Member Author

AliyanH commented Dec 21, 2022

Would it be possible to calculate the layer extent as we process the feature geometries?

Yes, I believe this can be done.

and set that via a <map-meta> at the end of the process?

It should only calculate the layer's extent when json.bbox is not present (I already map the json.bbox to a map-meta) I presume?

@prushforth
Copy link
Member

It should only calculate the layer's extent when json.bbox is not present (I already map the json.bbox to a map-meta) I presume?

I think that's correct.

@prushforth
Copy link
Member

This is working like a charm, thank you! Let's review together tomorrow.

@@ -409,6 +423,24 @@ export class WebMap extends HTMLMapElement {
{target: this}}));
Copy link
Member Author

@AliyanH AliyanH Dec 23, 2022

Choose a reason for hiding this comment

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

@prushforth A lot of the other code in web-map.js is specific to mapml-viewer and most likely does not work on web-map. We will need to go over this in the future. Ex (go up for code):
document.activeElement.nodeName === "MAPML-VIEWER"

Copy link
Member

Choose a reason for hiding this comment

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

Whoops! definitely, put it on the backlog...

src/mapml-viewer.js Outdated Show resolved Hide resolved
@AliyanH AliyanH merged commit 0c14dee into Maps4HTML:main Jan 17, 2023
prushforth pushed a commit to AliyanH/MapML.js that referenced this pull request Jan 23, 2023
* Add mapml2geojson and geojson2mapml functions to M.Util

* geojson versions for mapml-viewer and layer

* Add support for pasting GeoJSON

* Paste Layers using Ctrl+v

* Add default extent when json.bbox not present

* Add the ability to drag and drop layer-'s links and GeoJSON to the viewer

* Add localized default layer name

* Add ability to paste links using context menu and ctrl+v + Add more tests

* Create function for paste (pasteLayer), instead of repeating code

* make helper functions 'private'

* add bbox extent when given a feature

* Add test case for geojson feature (bbox/extent test)
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.

Integrate GeoJSON to MapML Elements
2 participants