Skip to content

Use OL extensions #4

@lymperis-e

Description

@lymperis-e

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions