Skip to content

Commit

Permalink
Merge pull request #6 from Ebubeker/main
Browse files Browse the repository at this point in the history
feat: changed the filtering endpoint to the one we have online
  • Loading branch information
majkshkurti authored Sep 14, 2023
2 parents 0f15911 + a0790af commit a3f7453
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 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: 2 additions & 2 deletions apps/goat/components/map/Layers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FILTERING } from "@/lib/api/apiConstants";
import { and_operator, or_operator } from "@/lib/utils/filtering_cql";
import type { LayerProps } from "react-map-gl";
import { v4 } from "uuid";
import { GET_NON_FILTERED_LAYER } from "@/lib/api/apiConstants";

interface LayersProps {
layers: XYZ_Layer[];
Expand Down Expand Up @@ -49,8 +50,7 @@ const Layers = (props: LayersProps) => {
addLayer([
{
id: "layer1",
sourceUrl:
"http://127.0.0.1:8080/collections/user_data.8c4ad0c86a2d4e60b42ad6fb8760a76e/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 a3f7453

Please sign in to comment.