Open mmnoo opened 1 year ago
Display the location of all user-generated sites on the map on globalmangrovewatch.org.
Under Categories -> Restoration & Conservation, create another "widget". Keep the same functionality and style as other widgets.
Places
In the widget Show the count for the number of sites for the current place. Clicking on the map updates the current place
On the map Show all sites on the map when the widget is turned on Cluster markers using an out-of-the-box plugin. Show a marker at the centroid of the polygon defined in question 1.3 When you click on the map, zoom to that place's extent and update the widget.
The pop-over Clicking on a single site opens the pop-over When the site loses focus, close the pop-over
In the pop-over
Omitting
needs api
let response = await fetch("https://mrtt-api-test-3.herokuapp.com/api/v2/dashboard/sites", {
method: "GET",
headers: headersList
});
let data = await response.text();
console.log(data);
[
{
"id": 1,
"site_name": "Site of Landscape of Org AAA",
"landscape_id": 1,
"landscape_name": "Landscape of Org AAA",
"organizations": [
{
"id": 3,
"organization_name": "Organization AAA"
}
]
}
]
Added site_area
field to the response:
[
{
"id": 171,
"site_name": "sept 1",
"site_area": null,
"landscape_id": 1,
"landscape_name": "Landscape AAA",
"organizations": [
{
"id": 1,
"organization_name": "Organization AAA"
}
]
},
{
"id": 172,
"site_name": "dashboard test plural",
"site_area": {
"type": "FeatureCollection",
"features": [
{
"id": "5331d15a6466b169a4bd2a2036bce5e6",
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[
-99.18829887659705,
32.44542659853579
],
[
-93.719269865857,
25.043067415054566
],
[
-59.413542434853795,
-15.683122891463356
],
[
0.24859222776115075,
-33.235180420212025
],
[
26.102183914895164,
10.898918393102079
],
[
-27.096552825936953,
50.818430922033
],
[
-96.70237659898821,
48.567638739640046
],
[
-99.18829887659705,
32.44542659853579
]
]
],
"type": "Polygon"
}
}
]
},
"landscape_id": 41,
"landscape_name": "new landscape1",
"organizations": [
{
"id": 1,
"organization_name": "Organization AAA"
}
]
},
{
"id": 173,
"site_name": "sept 2",
"site_area": null,
"landscape_id": 6,
"landscape_name": "Landscape Muffins",
"organizations": [
{
"id": 1,
"organization_name": "Organization AAA"
}
]
},
{
"id": 174,
"site_name": "Coubalan",
"site_area": {
"type": "FeatureCollection",
"features": [
{
"id": "49ec6ef86b7bbe325dafd7aa51258397",
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[
-16.184430045794414,
12.636568726518178
],
[
-16.185012367990026,
12.636318711004392
],
[
-16.18627018393147,
12.637023299553405
],
[
-16.186968970565715,
12.637886986093122
],
[
-16.18634006259498,
12.63868248427076
],
[
-16.185757740399367,
12.63968253560816
],
[
-16.185874870523094,
12.640184506590089
],
[
-16.18603631967136,
12.640329924569485
],
[
-16.185763098036887,
12.64076617801345
],
[
-16.185489876401448,
12.641263021305932
],
[
-16.185229073931566,
12.641299375655251
],
[
-16.18510488227983,
12.641141840103828
],
[
-16.1850055289583,
12.641287257539105
],
[
-16.185042786454005,
12.641517501641786
],
[
-16.184695049827212,
12.641565974058409
],
[
-16.18458327734095,
12.641190312591746
],
[
-16.18427279820989,
12.641093367607567
],
[
-16.184049253235713,
12.640960068193323
],
[
-16.18351522913133,
12.640366279051605
],
[
-16.18340643800599,
12.640187570083967
],
[
-16.18352466693537,
12.64012988833963
],
[
-16.183741419972165,
12.640120274714093
],
[
-16.183938468187563,
12.640379842470935
],
[
-16.18424389292136,
12.640620182750979
],
[
-16.184450793547796,
12.640697091592799
],
[
-16.18450005560149,
12.640552887495716
],
[
-16.18449020319116,
12.640331774387263
],
[
-16.18436212185074,
12.640187570083967
],
[
-16.184145368814,
12.639976070290743
],
[
-16.18387935372286,
12.639812638512822
],
[
-16.18387935372286,
12.63972611576439
],
[
-16.18413551640299,
12.639745343044765
],
[
-16.18415522122433,
12.639553070180298
],
[
-16.184056697116944,
12.63952422923819
],
[
-16.183849796490534,
12.639581911119251
],
[
-16.183751272383148,
12.63957229747308
],
[
-16.1837808296155,
12.639505001941103
],
[
-16.183899058544228,
12.63940886543692
],
[
-16.1837808296155,
12.639255046953906
],
[
-16.18366260068609,
12.63920697865926
],
[
-16.183711862739784,
12.63905316005544
],
[
-16.183835268688142,
12.638970806343153
],
[
-16.184148960132745,
12.638961803692084
],
[
-16.18442574670192,
12.638736737317913
],
[
-16.184656402176472,
12.63834962268848
],
[
-16.184711759489005,
12.637836469834099
],
[
-16.184637949737322,
12.637436239175798
],
[
-16.18442574670121,
12.63692308448789
],
[
-16.18432425829272,
12.636662005391486
],
[
-16.184430045794414,
12.636568726518178
]
]
],
"type": "Polygon"
}
}
]
},
"landscape_id": 76,
"landscape_name": "Casamance - Senegal",
"organizations": [
{
"id": 29,
"organization_name": "Wetlands International"
}
]
}
]
As per discussion, we only needed centroid
so exposing site_centroid
instead:
{
"id": 172,
"site_name": "dashboard test plural",
"site_centroid": {
"type": "Point",
"coordinates": [-99.18829887659705, 32.44542659853579]
},
"landscape_id": 41,
"landscape_name": "new landscape1",
"organizations": [
{
"id": 1,
"organization_name": "Organization AAA"
}
]
}
Note that we're not returning real centroid
yet. That will change when https://github.com/globalmangrovewatch/gmw-api/issues/81 is implemented.
Filtering by places was excluded for multiple reasons: timelines, it doesnt add much value, places are a bounding box extent, so counts will include sites from neighbouring places
https://github.com/Vizzuality/mangrove-atlas