diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index 94ed3798..2143ef23 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.2.7", + "version": "2.2.8", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.2.7", - "@performant-software/shared-components": "^2.2.7", + "@performant-software/semantic-components": "^2.2.8", + "@performant-software/shared-components": "^2.2.8", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index a9b6ecf5..228dc7e2 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.2.7", + "version": "2.2.8", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -37,8 +37,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/shared-components": "^2.2.7", - "@performant-software/geospatial": "^2.2.7", + "@performant-software/shared-components": "^2.2.8", + "@performant-software/geospatial": "^2.2.8", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/core-data/src/components/OverlayLayers.js b/packages/core-data/src/components/OverlayLayers.js index 8a0d0a72..9150bc16 100644 --- a/packages/core-data/src/components/OverlayLayers.js +++ b/packages/core-data/src/components/OverlayLayers.js @@ -1,26 +1,31 @@ // @flow -import { MapStyles } from '@performant-software/geospatial'; +import { MapStyles, WarpedImageLayerPeripleo as WarpedImageLayer } from '@performant-software/geospatial'; import { GeoJSONLayer, RasterLayer } from '@peripleo/maplibre'; import React from 'react'; import _ from 'underscore'; type Layer = { /** - * The type of layer to render. + * (Optional) GeoJSON data to pass to the layer. */ - layer_type: 'geojson' | 'raster', + content?: { [key: string]: any }, /** - * (Optional) GeoJSON data to pass to the layer. + * The type of layer to render. */ - data?: { [key: string]: any }, + layer_type: 'geojson' | 'raster' | 'georeference', /** * Name of the layer. */ name: string, + /** + * (Optional) Layer opacity. + */ + opacity?: number, + /** * (Optional) URL that contains the layer. This can be a URL to GeoJSON data or a Raster tile set. */ @@ -44,7 +49,7 @@ const OverlayLayer = (props: OverlayLayerProps) => { return ( { ); } + if (overlay.layer_type === 'georeference') { + return ( + + ); + } + return null; }; diff --git a/packages/core-data/src/components/PlaceLayersSelector.js b/packages/core-data/src/components/PlaceLayersSelector.js index 6a2eb4b4..59c18ceb 100644 --- a/packages/core-data/src/components/PlaceLayersSelector.js +++ b/packages/core-data/src/components/PlaceLayersSelector.js @@ -47,7 +47,7 @@ const PlaceLayersSelector = (props: Props) => { if (isSelected(layer)) { setSelectedLayers((prevSelected) => _.filter(prevSelected, (l) => l.url !== layer.url)); } else { - setSelectedLayers((prevSelected) => [...prevSelected, layer]); + setSelectedLayers((prevSelected) => [...prevSelected, { ...layer, content: JSON.parse(layer.content || '{}') }]); } }, [isSelected]); diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index 52ba623a..f951951c 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.2.7", + "version": "2.2.8", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -18,6 +18,7 @@ "build": "vite build && flow-copy-source -v src types" }, "dependencies": { + "@allmaps/maplibre": "^1.0.0-beta.25", "@mapbox/mapbox-gl-draw": "^1.4.3", "@maptiler/geocoding-control": "^1.2.2", "@turf/turf": "^6.5.0", diff --git a/packages/geospatial/src/components/GeoJsonLayer.js b/packages/geospatial/src/components/GeoJsonLayer.js index e6c1e4e3..fc2d24f1 100644 --- a/packages/geospatial/src/components/GeoJsonLayer.js +++ b/packages/geospatial/src/components/GeoJsonLayer.js @@ -15,48 +15,33 @@ type Props = { url?: string }; -const GeoJsonLayer = (props: Props) => { - const [data, setData] = useState(props.data); - - /** - * If the data is passed as a URL, fetches the passed URL and sets the response on the state. - */ - useEffect(() => { - if (props.url) { - fetch(props.url) - .then((response) => response.json()) - .then((json) => setData(json)); - } - }, [props.url]); - - return ( - - - - - - ); -}; +const GeoJsonLayer = (props: Props) => ( + + + + + +); GeoJsonLayer.defaultProps = { - fillStyle: MapStyles.fill, - pointStyle: MapStyles.point, - strokeStyle: MapStyles.stroke + fillStyle: MapStyles.fill.paint, + pointStyle: MapStyles.point.paint, + strokeStyle: MapStyles.stroke.paint }; export default GeoJsonLayer; diff --git a/packages/geospatial/src/components/LayerMenu.js b/packages/geospatial/src/components/LayerMenu.js index 0dc717be..b32e107c 100644 --- a/packages/geospatial/src/components/LayerMenu.js +++ b/packages/geospatial/src/components/LayerMenu.js @@ -4,7 +4,8 @@ import React, { Children, useCallback, useEffect, - useMemo, useRef, + useMemo, + useRef, useState } from 'react'; import { BsStack } from 'react-icons/bs'; @@ -103,6 +104,7 @@ const LayerMenu = (props: Props) => { position={props.position} >