Skip to content

Commit 4bf82df

Browse files
committed
2 parents c7c4636 + f7e36f5 commit 4bf82df

File tree

4 files changed

+111
-113
lines changed

4 files changed

+111
-113
lines changed

src/components/Filter/Filter.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,8 @@ const Filter = () => {
307307

308308
function processSearchBtn(formEvent) {
309309
formEvent.preventDefault()
310-
311310
console.log('Parameters: ', _selectedProductFilters)
312-
newSearch(_selectedProductFilters)
311+
newSearch(_selectedProductFilters, _selectedProductData)
313312
// dispatch(setshowSearchByGeom(false))
314313
}
315314

src/services/get-products-service.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { setProductsData } from '../redux/slices/mainSlice'
22
import { store } from '../redux/store'
33

44
export async function GetProductsService(provider, apikey) {
5-
65
const PROVIDERS = [
76
{ id: 'eusi', url: 'https://apps.euspaceimaging.com/test/internal/stapi' }
87
]
@@ -30,19 +29,21 @@ export async function GetProductsService(provider, apikey) {
3029

3130
productList.push({
3231
...product,
32+
conformsTo: ['https://geojson.org/schema/Polygon.json'],
3333
constraints,
34-
orderParameters
34+
orderParameters,
35+
providerBaseUrl: providerData.url
3536
})
3637
}
3738

38-
return { id: providerData.id, productList }
39+
return { id: providerData, productList }
3940
})
4041

4142
const results = await Promise.all(allProductRequests)
4243
console.log('products', results[0].productList)
4344
store.dispatch(setProductsData(results[0].productList))
4445

45-
/* const mockProducts = [
46+
/* const mockProducts = [
4647
{
4748
type: 'Product',
4849
conformsTo: ['https://geojson.org/schema/Polygon.json'],
@@ -236,5 +237,4 @@ export async function GetProductsService(provider, apikey) {
236237
default:
237238
console.error('Unsupported provider', provider)
238239
} */
239-
240240
}

src/services/get-search-service.js

+103-104
Original file line numberDiff line numberDiff line change
@@ -9,118 +9,117 @@ import {
99
} from '../redux/slices/mainSlice'
1010
import { addDataToLayer, footprintLayerStyle } from '../utils/mapHelper'
1111

12-
export async function SearchService(searchParams, typeOfSearch) {
13-
// const fakeOpportunities = {
14-
// "type": "FeatureCollection",
15-
// "features": [
16-
// {
17-
// "type": "Feature",
18-
// "geometry": {
19-
// "type": "Point",
20-
// "coordinates": [
21-
// 0,
22-
// 0
23-
// ]
24-
// },
25-
// "properties": {
26-
// "start_datetime": "2023-03-01T13:00:00Z",
27-
// "end_datetime": "2023-03-2T15:30:00Z",
28-
// "product_id": "EO",
29-
// "constraints": {
30-
// "gsd": [
31-
// 1.0,
32-
// 10.0
33-
// ],
34-
// "view:off_nadir": [
35-
// 0,
36-
// 30
37-
// ],
38-
// "sat_elevation": [
39-
// 60,
40-
// 90
41-
// ],
42-
// "view:sun_elevation": [
43-
// 10,
44-
// 90
45-
// ],
46-
// "sat_azimuth": [
47-
// 0,
48-
// 360
49-
// ],
50-
// "view:sun_azimuth": [
51-
// 0,
52-
// 360
53-
// ]
54-
// }
55-
// }
56-
// },
57-
// {
58-
// "type": "Feature",
59-
// "geometry": {
60-
// "type": "Point",
61-
// "coordinates": [
62-
// 0,
63-
// 0
64-
// ]
65-
// },
66-
// "properties": {
67-
// "start_datetime": "2023-03-02T13:00:00Z",
68-
// "end_datetime": "2023-03-03T15:30:00Z",
69-
// "product_id": "EO",
70-
// "constraints": {
71-
// "gsd": [
72-
// 1.0,
73-
// 10.0
74-
// ],
75-
// "view:off_nadir": [
76-
// 0,
77-
// 30
78-
// ],
79-
// "sat_elevation": [
80-
// 60,
81-
// 90
82-
// ],
83-
// "view:sun_elevation": [
84-
// 10,
85-
// 90
86-
// ],
87-
// "sat_azimuth": [
88-
// 0,
89-
// 360
90-
// ],
91-
// "view:sun_azimuth": [
92-
// 0,
93-
// 360
94-
// ]
95-
// }
96-
// }
97-
// }
98-
// ],
99-
// "links": {
100-
// "rel": "next",
101-
// "title": "Next page of Opportunities",
102-
// "method": "GET",
103-
// "type": "application/geo+json",
104-
// "href": "stat-api.example.com?page=2"
105-
// }
106-
// };
12+
export async function SearchService(searchParams, productData) {
13+
// const fakeOpportunities = {
14+
// "type": "FeatureCollection",
15+
// "features": [
16+
// {
17+
// "type": "Feature",
18+
// "geometry": {
19+
// "type": "Point",
20+
// "coordinates": [
21+
// 0,
22+
// 0
23+
// ]
24+
// },
25+
// "properties": {
26+
// "start_datetime": "2023-03-01T13:00:00Z",
27+
// "end_datetime": "2023-03-2T15:30:00Z",
28+
// "product_id": "EO",
29+
// "constraints": {
30+
// "gsd": [
31+
// 1.0,
32+
// 10.0
33+
// ],
34+
// "view:off_nadir": [
35+
// 0,
36+
// 30
37+
// ],
38+
// "sat_elevation": [
39+
// 60,
40+
// 90
41+
// ],
42+
// "view:sun_elevation": [
43+
// 10,
44+
// 90
45+
// ],
46+
// "sat_azimuth": [
47+
// 0,
48+
// 360
49+
// ],
50+
// "view:sun_azimuth": [
51+
// 0,
52+
// 360
53+
// ]
54+
// }
55+
// }
56+
// },
57+
// {
58+
// "type": "Feature",
59+
// "geometry": {
60+
// "type": "Point",
61+
// "coordinates": [
62+
// 0,
63+
// 0
64+
// ]
65+
// },
66+
// "properties": {
67+
// "start_datetime": "2023-03-02T13:00:00Z",
68+
// "end_datetime": "2023-03-03T15:30:00Z",
69+
// "product_id": "EO",
70+
// "constraints": {
71+
// "gsd": [
72+
// 1.0,
73+
// 10.0
74+
// ],
75+
// "view:off_nadir": [
76+
// 0,
77+
// 30
78+
// ],
79+
// "sat_elevation": [
80+
// 60,
81+
// 90
82+
// ],
83+
// "view:sun_elevation": [
84+
// 10,
85+
// 90
86+
// ],
87+
// "sat_azimuth": [
88+
// 0,
89+
// 360
90+
// ],
91+
// "view:sun_azimuth": [
92+
// 0,
93+
// 360
94+
// ]
95+
// }
96+
// }
97+
// }
98+
// ],
99+
// "links": {
100+
// "rel": "next",
101+
// "title": "Next page of Opportunities",
102+
// "method": "GET",
103+
// "type": "application/geo+json",
104+
// "href": "stat-api.example.com?page=2"
105+
// }
106+
// };
107107

108-
// TODO: PUT ENDPOINT HERE
109-
// check for selected product and map endpoint
110-
const endpoint = '/landsat/opportunities'
111-
await fetch(
112-
endpoint,
113-
{
114-
method: 'GET'
115-
}
116-
)
108+
// TODO: PUT ENDPOINT HERE
109+
// check for selected product and map endpoint
110+
await fetch(productData.providerBaseUrl + '/products/maxar/opportunities', {
111+
method: 'POST',
112+
body: {} // TODO
113+
})
117114
.then((response) => {
118115
if (response.ok) {
119116
return response.json()
120117
}
121118
throw new Error()
122119
})
123120
.then((json) => {
121+
console.log('RESPONSE', json)
122+
124123
const opportunities = json.response()
125124
store.dispatch(setSearchResults(opportunities))
126125
// store.dispatch(setmappedScenes(fakeOpportunities.features))

src/utils/searchHelper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as h3 from 'h3-js'
2626
import debounce from './debounce'
2727
import { AddMosaicService } from '../services/post-mosaic-service'
2828

29-
export function newSearch(filters) {
29+
export function newSearch(filters, productData) {
3030
const geometry = store.getState().mainSlice.searchGeojsonBoundary
3131
const dates = store.getState().mainSlice.searchDateRangeValue
3232
const productId = store.getState().mainSlice.selectedProductData.id
@@ -67,7 +67,7 @@ export function newSearch(filters) {
6767

6868
console.log(query)
6969

70-
SearchService(query)
70+
SearchService(query, productData)
7171

7272
// const _selectedCollection = store.getState().mainSlice.selectedCollectionData
7373

0 commit comments

Comments
 (0)