subsurface/taxonomy.c
Dirk Hohndel bda482a30a Geo taxonomy: add higher level notion of city
This renames the local name for the location as town and adds the concept
of a city as the level 3 admin category. In some regions (e.g. at times in
Italy) the local hamlet name is shown as toponymName but the name of the
actual city is given as adminName3.

With this change "city" will always reflect our best guess: adminName3 if
it exists, otherwise the toponymName. Whereas "town" is always the
toponymName.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-10 09:51:50 -07:00

38 lines
857 B
C

#include "taxonomy.h"
#include "gettext.h"
#include <stdlib.h>
char *taxonomy_category_names[TC_NR_CATEGORIES] = {
QT_TRANSLATE_NOOP("getTextFromC", "None"),
QT_TRANSLATE_NOOP("getTextFromC", "Ocean"),
QT_TRANSLATE_NOOP("getTextFromC", "Country"),
QT_TRANSLATE_NOOP("getTextFromC", "State"),
QT_TRANSLATE_NOOP("getTextFromC", "County"),
QT_TRANSLATE_NOOP("getTextFromC", "Town"),
QT_TRANSLATE_NOOP("getTextFromC", "City")
};
// these are the names for geoname.org
char *taxonomy_api_names[TC_NR_CATEGORIES] = {
"none",
"name",
"countryName",
"adminName1",
"adminName2",
"toponymName",
"adminName3"
};
struct taxonomy *alloc_taxonomy()
{
return calloc(TC_NR_CATEGORIES, sizeof(struct taxonomy));
}
void free_taxonomy(struct taxonomy *t)
{
if (t) {
for (int i = 0; i < TC_NR_CATEGORIES; i++)
free((void *)t[i].value);
free(t);
}
}