Skip to content

Commit

Permalink
Added all colors
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Balitzki <emil.balitzki@gmail.com>
  • Loading branch information
Corgam committed Jul 12, 2024
1 parent 9628834 commit 878ce71
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
42 changes: 41 additions & 1 deletion backend/metadata-database/init-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,47 @@ const datasets = [
PolygonColoring: {
attributeName: "nutzart",
colors: [
{ color: "darkred", values: ["halde", "friedhof", "wohnbaufläche"] },
{
color: "Plum",
values: [
"Wohnbaufläche",
"Industrie- und Gewerbefläche",
"Halde",
"Bergbaubetrieb",
"Tagebau, Grube Steinbruch",
"Fläche gemischter Nutzung",
"Fläche besonderer funktionaler Prägung",
"Sport-, Freizeit- und Erholungsfläche",
"Friedhof",
],
},
{
color: "LightGreen",
values: [
"Landwirtschaft",
"Wald",
"Gehölz",
"Heide",
"Moor",
"Sumpf",
"Unland/Vegetationslose Fläche",
],
},
{
color: "RosyBrown",
values: [
"Straßenverkehr",
"Weg",
"Platz",
"Bahnverkehr",
"Flugverkehr",
"Schiffsverkehr",
],
},
{
color: "SkyBlue",
values: ["Fließgewässer", "Hafenbecken", "Stehendes Gewässer"],
},
],
},
Tables: [],
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/components/MapView/MapDatasetVisualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const MapDatasetVisualizer: React.FC<MapDatasetVisualizerProps> = ({
new LatLng(51.505, -0.09)
);

/**
* Updates the data for a specific dataset.
*/
const updateDatasetData = useCallback(
(newData: FeatureCollection, bounds: LatLngBounds) => {
setCurrentTabsCache((prevCache) => {
Expand Down Expand Up @@ -87,7 +90,11 @@ const MapDatasetVisualizer: React.FC<MapDatasetVisualizerProps> = ({
updateDatasetData
);

// Function to determine the color based on usageType using PolygonColoring from metadata
/**
* Function to determine the color based on usageType using PolygonColoring from metadata
* @param usageType the usage type string
* @returns the color to use
*/
const getColor = (usageType: string) => {
if (dataset.metaData && dataset.metaData.polygonColoring) {
const coloring = dataset.metaData.polygonColoring;
Expand All @@ -100,6 +107,9 @@ const MapDatasetVisualizer: React.FC<MapDatasetVisualizerProps> = ({
return "#3388ff";
};

/**
* Fetches the data for current viewport.
*/
useEffect(() => {
// Check if data has been fetched
if (!geoData || !dataset.metaData) return;
Expand Down

0 comments on commit 878ce71

Please sign in to comment.