Skip to content

Commit

Permalink
Merge branch 'main' into feat/get-layers-from-db
Browse files Browse the repository at this point in the history
  • Loading branch information
baghdasarovnorayr committed Sep 14, 2023
2 parents 6c7a789 + cd7bf8a commit 1a09044
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { NextResponse } from "next/server";

const url = "http://127.0.0.1:8080";
import { GET_FEATURE_PROPERTY_KEYS } from "@/lib/api/apiConstants";

export async function GET(request: Request) {
const layer_id = request.url.slice(request.url.lastIndexOf("/") + 1);
console.log(layer_id);

try {
const res = await fetch(`${url}/collections/${layer_id}/queryables`);
const res = await fetch(GET_FEATURE_PROPERTY_KEYS(layer_id));

const keys = await res.json();

Expand Down
4 changes: 3 additions & 1 deletion apps/goat/components/map/Layers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { and_operator, or_operator } from "@/lib/utils/filtering_cql";
import type { LayerProps } from "react-map-gl";
import { v4 } from "uuid";
import type { Layer } from "@/lib/store/styling/slice";
import { GET_NON_FILTERED_LAYER } from "@/lib/api/apiConstants";

interface LayersProps {
layers: XYZ_Layer[];
Expand Down Expand Up @@ -66,7 +67,8 @@ const Layers = (props: LayersProps) => {
addLayer([
{
id: "layer1",
sourceUrl: `https://geoapi.goat.dev.plan4better.de/collections/${projectId}/tiles/{z}/{x}/{y}`,
// sourceUrl: `https://geoapi.goat.dev.plan4better.de/collections/${projectId}/tiles/{z}/{x}/{y}`,
sourceUrl: GET_NON_FILTERED_LAYER(sampleLayerID),
color: "#FF0000",
},
]);
Expand Down
4 changes: 3 additions & 1 deletion apps/goat/lib/api/apiConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export const API = {
project: "api/v2/content/project",
};
// export const FILTERING = "http://localhost:3000/api/map/filtering/layer/";
export const FILTERING = (layer_id: string) => `http://127.0.0.1:8080/collections/${layer_id}/tiles/{z}/{x}/{y}`;
export const FILTERING = (layer_id: string) => `https://geoapi.goat.dev.plan4better.de/collections/${layer_id}/tiles/{z}/{x}/{y}`;
export const GET_FEATURE_PROPERTY_KEYS = (layer_id: string) => `https://geoapi.goat.dev.plan4better.de/collections/${layer_id}/queryables`
export const GET_NON_FILTERED_LAYER = (layer_id: string) => `https://geoapi.goat.dev.plan4better.de/collections/${layer_id}/tiles/{z}/{x}/{y}`

0 comments on commit 1a09044

Please sign in to comment.