Skip to content

Commit 2ffff16

Browse files
authored
Merge pull request #65 from Element84/mp/filters
Adds most functionality ready for final sprint demo
2 parents d30d99f + 3372fc8 commit 2ffff16

20 files changed

Lines changed: 466 additions & 53 deletions

demo/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18.12.0

demo/Mockups/Mock - 1.png

526 KB
Loading

demo/Mockups/Mock - 2.png

1.16 MB
Loading

demo/Mockups/Mock - 3.png

1.02 MB
Loading

demo/Mockups/Mock - 4.png

985 KB
Loading

demo/api/api_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ class Product(BaseModel):
4141
id: str
4242
title: str
4343
description: str
44-
keywords: List[str]
45-
license: str
46-
providers: List[Provider]
47-
links: List[Link]
44+
# keywords: List[str]
45+
# license: str
46+
# providers: List[Provider]
47+
# links: List[Link]
4848
constraints: Optional[ProductConstraints] = Field(
4949
default=None,
5050
description="Query constraints that will filter the opportunity results list.",

demo/api/backends/sentinel_backend.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from datetime import timedelta
44
from typing import Any, Union
55

6+
from geojson_pydantic.geometries import Point
67
import pystac
78
from api.api_types import (Opportunity, OpportunityCollection,
89
OpportunityProperties, Product, ProductConstraints,
@@ -45,9 +46,15 @@ def adjust_date_time(value: MaybeDate) -> Any:
4546

4647

4748
def stac_item_to_opportunity(item: pystac.Item, product_id: str) -> Opportunity:
49+
point_vals = (item.geometry or {}).get('coordinates',[[[0,0]]])[0][0]
50+
4851
return Opportunity(
49-
geometry=item.geometry, # type: ignore
50-
properties=adjust_date_times({"product_id": product_id, **item.properties}),
52+
geometry=Point(coordinates=(point_vals[0], point_vals[1])),
53+
properties=adjust_date_times({
54+
"product_id": product_id,
55+
"title": item.id,
56+
**item.properties
57+
}),
5158
id=item.id,
5259
)
5360

demo/app/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# 🍃 Next.js Leaflet Starter
2+
3+
Jumpstart your new Next.js mapping project with Leaflet!
4+
5+
## ⚡ Quick Deploy
6+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/colbyfayock/next-leaflet-starter) [![Deploy with Vercel Now](https://zeit.co/button)](https://vercel.com/import/project?template=https://github.com/colbyfayock/next-leaflet-starter)
7+
8+
9+
## 🧰 What This Includes
10+
* [Yarn](https://yarnpkg.com/en/)
11+
* [Next.js](https://nextjs.org/)
12+
* [Leaflet](https://leafletjs.com/)
13+
* [React Leaflet](https://react-leaflet.js.org)
14+
15+
## 🚀 Getting Started
16+
17+
### Requirements
18+
* [Yarn](https://yarnpkg.com/en/)
19+
20+
### Quick Start
21+
```
22+
yarn create next-app -e https://github.com/colbyfayock/next-leaflet-starter
23+
# or
24+
npm run create-next-app -e https://github.com/colbyfayock/next-leaflet-starter
25+
```
26+
27+
### Running the Project
28+
First, run the development server:
29+
30+
```bash
31+
yarn dev
32+
```
33+
34+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
35+
36+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

demo/app/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ const nextConfig = {
2626
},
2727
]
2828
},
29+
experimental: {
30+
proxyTimeout: 300000
31+
}
2932
}
3033

3134

demo/app/src/components/Map/Map.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ const Map = (props) => {
5656
* on layer created handler
5757
*/
5858
function onCreated(e) {
59-
setUserParams({...userParams, bbox: e.layer.getBounds()});
59+
setUserParams({...userParams, geometry: {
60+
"type": "Point",
61+
"coordinates": [e.layer._latlng.lng, e.layer._latlng.lat]
62+
}
63+
});
6064
}
6165

6266
/**
@@ -92,8 +96,8 @@ const Map = (props) => {
9296
draw={{
9397
circle: false,
9498
circlemarker: false,
95-
marker: false,
96-
polygon: true,
99+
marker: true,
100+
polygon: false,
97101
polyline: false,
98102
rectangle: false,
99103
}}

0 commit comments

Comments
 (0)