Skip to content

Commit

Permalink
Merge pull request #20 from openearthplatforminitiative/feat/text-abo…
Browse files Browse the repository at this point in the history
…ut-deforestation-api

feat: add deforestation description and examples
  • Loading branch information
henrikav authored Jan 25, 2024
2 parents 42a49b5 + c74d35b commit a12af8e
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 35 deletions.
22 changes: 13 additions & 9 deletions app/code-examples/deforestation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
async function getProfile(accessToken) {
let accessToken = localStorage.getItem('access_token');
const response = await fetch(
'https://api-test.openepi.io/deforestation/basin?' +
new URLSearchParams({
lon: '30.0619',
lat: '-1.9441',
start_year: '2010',
end_year: '2019',
})
);
const data = await response.json();

const response = await fetch('https://developer.openepi.io/v1/me', {
headers: {
Authorization: 'Bearer ' + accessToken,
},
});
// Get the total forest cover loss within the returned river basin over the time period
const loss = json.features[0].properties.daterange_tot_treeloss;

const data = await response.json();
}
console.log(`Total forest cover loss: ${loss} km^2`);
13 changes: 13 additions & 0 deletions app/code-examples/deforestation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from httpx import Client

with Client() as client:
response = client.get(
url="https://api-test.openepi.io/deforestation/basin",
params={"lon": 30.0619, "lat": -1.9441, "start_year": 2010, "end_year": 2019},
)

# Get the total forest cover loss within the returned river basin over the time period
json = response.json()
loss = json["features"][0]["properties"]["daterange_tot_treeloss"]

print(f"Total forest cover loss: {loss} km^2")
77 changes: 51 additions & 26 deletions app/data-catalog/deforestation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ const Home = () => {

<Box className={'flex flex-col gap-8 mt-14'}>
<Typography className={'text-5xl'}>Deforestation API</Typography>
<Typography className={'text-2xl'}>Sub header</Typography>
<Typography className={'text-2xl'}>
Aggregated deforestation data on a global scale
</Typography>
</Box>
<Box className={'flex lg:flex-row flex-col gap-6 mt-20'}>
<InfoCard
externalLink={true}
header={'OpenAPI Spec'}
subHeader={'Some text about the OpenAPI spec.'}
subHeader={
'Specification of all endpoints available in the deforestation api.'
}
CardIcon={OpenApiIcon}
href={'https://api-test.openepi.io/deforestation/redoc'}
/>
<InfoCard
externalLink={true}
header={'Github'}
subHeader={'Some text about the Github repository.'}
subHeader={'Explore the source code behind the deforestation api.'}
CardIcon={GithubIconBlack}
href={
'https://github.com/openearthplatforminitiative/deforestation-api'
Expand All @@ -47,36 +51,57 @@ const Home = () => {
<Typography className={'text-4xl'}>More info</Typography>
<Typography className={'text-3xl mt-8'}>Data sources</Typography>
<Typography className={'text-base mt-6'}>
There is a need for a robust and accessible digital infrastructure for
open data and algorithms on weather, water, earth, and vegetation,
across projects, sectors, and contexts – providing a base for the
necessary local technology innovation. The Open Earth Platform
(OpenEPI) is an initiative to prepare for such an infrastructure.
</Typography>
<Typography className={'text-3xl mt-14'}>Methods</Typography>
<Typography className={'text-base mt-6'}>
There is a need for a robust and accessible digital infrastructure for
open data and algorithms on weather, water, earth, and vegetation,
across projects, sectors, and contexts – providing a base for the
necessary local technology innovation. The Open Earth Platform
(OpenEPI) is an initiative to prepare for such an infrastructure.
The deforestation data covers the period from 2001 to 2022 and is
provided by the{' '}
<a
href={'https://glad.umd.edu/'}
className={'underline hover:no-underline'}
>
Global Land Analysis and Discovery (GLAD)
</a>{' '}
laboratory at the University of Maryland, in partnership with{' '}
<a
href={'https://www.globalforestwatch.org/'}
className={'underline hover:no-underline'}
>
Global Forest Watch (GFW)
</a>
. The data are freely available for use under a{' '}
<a
href={'https://creativecommons.org/licenses/by/4.0/'}
className={'underline hover:no-underline'}
>
Creative Commons Attribution 4.0 International License
</a>
. River basin polygons data is provided by{' '}
<a
href={'https://www.hydrosheds.org/products/hydrobasins'}
className={'underline hover:no-underline'}
>
HydroSHEDS
</a>
. The basin data are feely available for both non-commercial and
commercial use under a licence agreement included in the{' '}
<a
href={
'https://data.hydrosheds.org/file/technical-documentation/HydroSHEDS_TechDoc_v1_4.pdf'
}
className={'underline hover:no-underline'}
>
HydroSHEDS Technical Documentation
</a>
.
</Typography>
<Typography className={'text-3xl mt-14'}>Processing</Typography>
<Typography className={'text-base mt-6'}>
There is a need for a robust and accessible digital infrastructure for
open data and algorithms on weather, water, earth, and vegetation,
across projects, sectors, and contexts – providing a base for the
necessary local technology innovation. The Open Earth Platform
(OpenEPI) is an initiative to prepare for such an infrastructure.
Using the river basin polygons, the deforestation data are aggregated
per basin and year.
</Typography>
<Typography className={'text-4xl mt-16'}>Examples</Typography>
<Typography className={'text-3xl mt-8'}>Example 1</Typography>
<Typography className={'text-base mt-6'}>
There is a need for a robust and accessible digital infrastructure for
open data and algorithms on weather, water, earth, and vegetation,
across projects, sectors, and contexts – providing a base for the
necessary local technology innovation. The Open Earth Platform
(OpenEPI) is an initiative to prepare for such an infrastructure.
Get the total forest cover loss within the queried river basin over
the given time period using JavaScript.
</Typography>
<CodeBlock
language={'javascript'}
Expand Down

0 comments on commit a12af8e

Please sign in to comment.