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

Use OL extensions #4

Open
lymperis-e opened this issue Jan 16, 2025 · 0 comments
Open

Use OL extensions #4

lymperis-e opened this issue Jan 16, 2025 · 0 comments

Comments

@lymperis-e
Copy link

Hi and thank you for the effort you put into this library, it is truly great!

I am trying to use the "ol-stac" library, which extends OL (specifically the LayerGroup), to read items directly from STAC catalogs. Here's the example in the official OL docs.

Now I can't really figure out how to do this. My best guess was to use the extend function from the catalogue, and then use an <olStac /> tag. Here's my code:

import { default as STAC } from "ol-stac";
import proj4 from "proj4";
import { register } from "ol/proj/proj4.js";
import { extend } from "@react-ol/fiber";

register(proj4); // required to support source reprojection

extend({ olStac: STAC });

export const StacLayer = ({ url }: { url: string }) => {
  return <olStac url={url} displayPreview={true} />;
};

It does not work, and I do not think it should tbh I get the following error:

React-Openlayers-Fiber Error: Couldn't add this child to this container. You can specify how to attach this type of child ("null") to this type of container ("Map") using the "attach" props

Well... Any help would be much appreciated

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

1 participant