Skip to content

Commit

Permalink
feat(fao): migrate FAOcountries query from RW to Data API
Browse files Browse the repository at this point in the history
  • Loading branch information
willian-viana committed Dec 19, 2024
1 parent 8a70368 commit 60e415a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions services/country.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { all, spread } from 'axios';

import { cartoRequest } from 'utils/request';
import { cartoRequest, dataRequest } from 'utils/request';
import { getGadm36Id } from 'utils/gadm';

import countryLinks from './country-links.json';
Expand All @@ -9,7 +9,7 @@ const SQL_QUERIES = {
getCountries:
"SELECT iso, name_engli as name FROM gadm36_countries WHERE iso != 'TWN' AND iso != 'XCA' ORDER BY name",
getFAOCountries:
'SELECT DISTINCT country AS iso, name FROM table_1_forest_area_and_characteristics',
'SELECT iso, country AS name FROM data WHERE 1 = 1 AND year = 2020',
getRegions:
"SELECT gid_1 as id, name_1 as name FROM gadm36_adm1 WHERE iso = '{iso}' ORDER BY name ",
getSubRegions:
Expand All @@ -25,8 +25,8 @@ export const getCountriesProvider = () => {
};

export const getFAOCountriesProvider = () => {
const url = `/sql?q=${SQL_QUERIES.getFAOCountries}`;
return cartoRequest.get(url);
const url = `dataset/fao_forest_extent/v2020/query/json?sql=${SQL_QUERIES.getFAOCountries}`;
return dataRequest.get(url);
};

export const getRegionsProvider = ({ adm0, token }) => {
Expand Down

0 comments on commit 60e415a

Please sign in to comment.