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

Add support for other projections #199

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

gjmooney
Copy link
Collaborator

@gjmooney gjmooney commented Nov 7, 2024

Small fix for issue with the tif layer loading in the wrong location mentioned in #196 Should fix #191

fix

Added support for reading projection info from gqz files.

EPSG:3857
3857

EPSG:4326
4326

@gjmooney gjmooney added the bug Something isn't working label Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Binder 👈 Launch a Binder on branch gjmooney/jupytergis/suport_proj4js

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Neat!

@martinRenou
Copy link
Member

Should fix #191

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 7, 2024

Should fix #191

I saved a qgz using the aitoff projection, and opening that in Jupyter GIS shows the layer with the default projection, but we still need to implement getting the projection from the QGIS and set that properly in JGIS. It seems like it should be straight forward enough, qgz files have the proj string used in proj.def() but I was getting some weird webpack errors when I was playing around with it, so maybe not so straight forward 🤷‍♂️

@martinRenou
Copy link
Member

What kind of webpack errors?

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 7, 2024

What kind of webpack errors?

For example, replacing proj4.defs(Array.from(proj4list)) with proj4.defs('EPSG:7030, 'aitoff +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'
causes

error

@martinRenou
Copy link
Member

Oo that is really weird. I don't understand how this error message can relate to the code being run.

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 7, 2024

Oo that is really weird. I don't understand how this error message can relate to the code being run.

Especially since proj4.defs(Array.from(proj4list)) works fine! It's bizarre 🫠

@martinRenou
Copy link
Member

It says qgisplugin failed to activate. Did you change anything in the plugin implementation?

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 7, 2024

It says qgisplugin failed to activate. Did you change anything in the plugin implementation?

Nope, literally just changed that one line.

@martinRenou
Copy link
Member

Can you push the diff loading the projection from the qgz file, then share that file?

I will give it a try locally

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 7, 2024

Can you push the diff loading the projection from the qgz file, then share that file?

I will give it a try locally

I'm not loading from the qgz directly yet, I just looked in the extracted qgz file to get the aitoff +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs string to create the proj4 def to use for the OpenLayers Projection

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Preview PR at appsharing.space

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Integration tests repot: appsharing.space

@martinRenou
Copy link
Member

Can you try running:

proj4.defs('EPSG:7030, 'aitoff +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
register(proj4);

At the constructor of the view instead of at the top of the file? Wondering if the error message would get more useful that way.

@gjmooney
Copy link
Collaborator Author

gjmooney commented Nov 8, 2024

Moving it to the constructor shows

e2

I did some digging and it seems like the .def() works, but when register gets called
it hits https://github.com/openlayers/openlayers/blob/main/src/ol/proj/proj4.js#L78 which starts https://github.com/proj4js/proj4js/blob/master/lib/core.js#L55 and ends up at https://github.com/proj4js/proj4js/blob/master/lib/core.js#L51 where we get to https://github.com/proj4js/proj4js/blob/master/lib/Proj.js#L24 but "aitoff" isn't in the names object at https://github.com/proj4js/proj4js/blob/master/lib/projections.js#L27 so it throws https://github.com/proj4js/proj4js/blob/master/lib/Proj.js#L26

So maybe proj4js just doesn't support aitoff projections?

@martinRenou martinRenou added enhancement New feature or request and removed bug Something isn't working labels Nov 19, 2024
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks!

@martinRenou martinRenou merged commit 8c05d8d into geojupyter:main Nov 26, 2024
8 of 9 checks passed
@gjmooney gjmooney deleted the suport_proj4js branch November 26, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QGIS project & projection
2 participants