Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to code after changing source-field to camelCase #18

Merged
merged 7 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
opentrees-data/
data-backup/
tree-source/

/data/
Expand Down
2 changes: 1 addition & 1 deletion bin/failed-sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const main = () => {
source.country,
source.id,
"is broken?",
!!source.brokenDownload
!!source.broken
);
}
});
Expand Down
20 changes: 0 additions & 20 deletions bin/tree-ids.js

This file was deleted.

2 changes: 1 addition & 1 deletion bin/write-sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const handleSource = async (sourceName) => {
format: source.format || null,
filename: source.filename || null,
crosswalk: null,
gdal_options: source.gdal_options || null,
gdalOptions: source.gdalOptions || null,
};

obj.crosswalk = dealWithCrossWalk(source.crosswalk);
Expand Down
2 changes: 1 addition & 1 deletion identity-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
download: null,
format: null,
filename: null,
gdal_options: null,
gdalOptions: null,
license: null,
email: null,
contact: null,
Expand Down
11 changes: 11 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const __dirname = path.dirname(import.meta.url.split(":")[1]);
export const ROOT_DIRECTORY = path.join(__dirname, "..");
export const SOURCES_DIRECTORY =
process.env.SOURCES_DIRECTORY || path.join(ROOT_DIRECTORY, "sources");

export const DATA_BACKUP_DIRECTORY =
zoobot marked this conversation as resolved.
Show resolved Hide resolved
process.env.DATA_BACKUP_DIRECTORY || path.join(ROOT_DIRECTORY, "data-backup");
export const RAW_BACKUP_DIRECTORY =
process.env.RAW_BACKUP_DIRECTORY || path.join(DATA_BACKUP_DIRECTORY, "raw-backup");

export const DATA_DIRECTORY =
process.env.DATA_DIRECTORY || path.join(ROOT_DIRECTORY, "data");
export const RAW_DIRECTORY =
Expand All @@ -16,11 +22,14 @@ export const GEOJSON_DIRECTORY =
process.env.DATA_DIRECTORY || path.join(DATA_DIRECTORY, "geojson");
export const NORMALIZED_DIRECTORY =
process.env.NORMALIZED_DIRECTORY || path.join(DATA_DIRECTORY, "normalized");

export const CONCATENATED_FILEPATH =
process.env.CONCATENATED_FILEPATH ||
path.join(DATA_DIRECTORY, "concatenated.geojsons");

export const TILES_FILEPATH =
process.env.TILES_FILEPATH || path.join(DATA_DIRECTORY, "trees.mbtiles");

export const SERVER_INDEX_FILEPATH =
process.env.SERVER_INDEX_FILEPATH ||
path.join(ROOT_DIRECTORY, "src/html/index.html");
Expand All @@ -41,6 +50,7 @@ export const POSSIBLE_LONGITUDE_FIELDS = [
"lon",
"LONG",
"X",
"x",
"X_LONG",
"long",
"X_Koordina",
Expand All @@ -63,6 +73,7 @@ export const POSSIBLE_LATITUDE_FIELDS = [
"LAT",
"lat",
"Y",
"y",
"Y_LAT",
"lat",
"Y_Koordina",
Expand Down
1 change: 0 additions & 1 deletion src/core/cleanTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ function cleanTree(t) {
// TODO: titlecase fields, so FAIR => Fair ?

// -- TODO: handle all the dbh's that are ranges in mm.
// console.log(t.scientific);

if (t.maturity) {
let m = String(t.maturity);
Expand Down
4 changes: 4 additions & 0 deletions src/core/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ const sources = raw.map((source) => {
path: path.join(config.RAW_DIRECTORY, `${source.id}.${extension}`),
extension,
},
rawBackup: {
path: path.join(config.RAW_BACKUP_DIRECTORY, `${source.id}.${extension}`),
extension,
},
geojson: {
path: path.join(config.GEOJSON_DIRECTORY, `${source.id}.geojsons`),
extension: "geojsons",
Expand Down