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

Support GeoMakie from other packages? #312

Open
tpoisot opened this issue Feb 14, 2025 · 8 comments
Open

Support GeoMakie from other packages? #312

tpoisot opened this issue Feb 14, 2025 · 8 comments

Comments

@tpoisot
Copy link

tpoisot commented Feb 14, 2025

Hi!

I'm interested in building support for GeoMakie in SpeciesDistributionToolkit - the package is already well integrated with makie, but geomakie would make sense to support as well.

The raster data store their projection info, so I am mostly after two pieces of info.

What's the easiest way to add GeoMakie? Is there a GeoMakieCore or equivalent package I can add to minimze dependencies?

How can I set some GeoAxis parameters when plotting? Because our layers have their own projection, this would be useful to set the source string when adding to a geoaxis.

Thanks!

@asinghvi17
Copy link
Member

Hey! As long as you have Makie integration things should "just work" here. The closest thing to a "GeoMakieCore" would actually be GeoInterface and GeoInterfaceMakie, for vector data. If you really need to edit some functionality, I would just use an extension.

I've been trying to add "automagic" CRS support for a while in GeoMakie, but it seems to cause infinite loops for some reason. When I try again, I'll let you know - probably this weekend. But the way to embed those parameters would be through implementing GeoInterface.crs on your object.

Feel free to ping me if you have any more questions - or any cool plots to show off!

@tpoisot
Copy link
Author

tpoisot commented Feb 14, 2025

GeoInterface.crs is almost essentially a one-line fix, so I'll start experimenting with this! Thanks!

@tpoisot
Copy link
Author

tpoisot commented Feb 14, 2025

@asinghvi17 - quick question for you, I think: is returning the crs as a proj string enough?

@asinghvi17
Copy link
Member

Yes, that should be fine. You may want to wrap in GeoFormatTypes.ProjString(yourprojstring) for maximum compatibility.

You should also make sure your Proj-string has a +type=crs somewhere in there...

@tpoisot
Copy link
Author

tpoisot commented Feb 14, 2025

Cool. I'm really trying to minimize the amount of external dependencies, so needing GeoFormatTypes and Extents in addition to GeoInterface doesn't seem worth it just for GeoMakie plotting. I'll probably revisit in the future. Thanks for the help anyway!

@asinghvi17
Copy link
Member

They are already brought in by GeoInterface, so you don't really lose much :)

@tpoisot
Copy link
Author

tpoisot commented Feb 14, 2025

I didn't catch that when reading the doc. That's where a simple example for rasters would be useful - my understanding is that to add the interface I would need three dependencies - is this not the case?

@asinghvi17
Copy link
Member

Not at all, you can get away with just GI.crs(x) = "EPSG:4326" if you want! I thought I had a few examples but maybe they were manual fields...

The way you'd do the plot now is surface(myraster; source = GI.crs(myraster)). At some point that source keyword will be auto-detected and therefore unnecessary :)

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

No branches or pull requests

2 participants