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

Add support for OpenAIP #231

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 25 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ case $ac_cv_enable_bluemarble in
esac
AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])

# OpenAIP
AC_ARG_ENABLE(openaip, AS_HELP_STRING([--enable-openaip],
[enable openaip stuff (default is enable)]),
[ac_cv_enable_openaip=$enableval],
[ac_cv_enable_openaip=yes])
AC_CACHE_CHECK([whether to enable OpenAIP stuff],
[ac_cv_enable_openaip], [ac_cv_enable_openaip=yes])
case $ac_cv_enable_openaip in
yes)
AC_DEFINE(VIK_CONFIG_OPENAIP, [], [OPENAIP STUFF])
;;
esac
AM_CONDITIONAL([OPENAIP], [test x$ac_cv_enable_openaip = xyes])

# GeoNames http://www.geonames.org/
AC_ARG_ENABLE(geonames, AS_HELP_STRING([--enable-geonames],
[enable Geonames stuff (default is enable)]),
Expand Down Expand Up @@ -575,6 +589,17 @@ AC_ARG_WITH(thunderforest_apikey,
[VIK_CONFIG_THUNDERFOREST_KEY="\"7387c111d85642b18f63608bd4cb8b4f\""])
AC_DEFINE_UNQUOTED(VIK_CONFIG_THUNDERFOREST_KEY, ${VIK_CONFIG_THUNDERFOREST_KEY}, [Thunderforest key])

OpenAIP Compile time defined key
AC_ARG_WITH(openaip_apikey,
[AS_HELP_STRING([--with-openaip_apikey],
[API Key for OpenAIP tiles.
Please register your own if you're going to distribute the
package, as requests are limited per key.])],
[VIK_CONFIG_OPENAIP_KEY="\"${withval}\""],
[VIK_CONFIG_OPENAIP_KEY="\"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\""]) // <- Replace XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with your API key
AC_DEFINE_UNQUOTED(VIK_CONFIG_OPENAIP_KEY, ${VIK_CONFIG_OPENAIP_KEY}, [OpenAIP key])


AC_ARG_WITH(geonames_username,
[AS_HELP_STRING([--with-geonames_username],
[Username for the GeoNames webservice.
Expand Down
5 changes: 5 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ libviking_a_SOURCES += \
bluemarble.c bluemarble.h
endif

if OPENAIP
libviking_a_SOURCES += \
openaip.c openaip.h
endif

if GEONAMES
libviking_a_SOURCES += \
geonames.c geonames.h \
Expand Down
2 changes: 1 addition & 1 deletion src/map_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define MAP_ID_MBTILES 23
#define MAP_ID_OSM_METATILES 24
//#define MAP_ID_MAPBOX_OUTDOORS 25 // Access deactivated

#define MAP_ID_OPENAIP 26
#define MAP_ID_BING_AERIAL 212

#define MAP_ID_OPEN_TOPO_MAP 901
Expand Down
4 changes: 4 additions & 0 deletions src/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "osm.h"
#include "osm-traces.h"
#include "bluemarble.h"
#include "openaip.h"
#include "geonames.h"
#include "dir.h"
#include "datasources.h"
Expand Down Expand Up @@ -256,6 +257,9 @@ void modules_init()
#ifdef VIK_CONFIG_BLUEMARBLE
bluemarble_init();
#endif
#ifdef VIK_CONFIG_OPENAIP
openaip_init();
#endif
#ifdef VIK_CONFIG_GEONAMES
geonames_init();
#endif
Expand Down
46 changes: 46 additions & 0 deletions src/openaip.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* viking -- GPS Data and Topo Analyzer, Explorer, and Manager
*
* Copyright (C) 2003-2005, Evan Battaglia <[email protected]>
* Copyright (C) 2008, Guilhem Bonnefille <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include "openaip.h"
#include "vikmapslayer.h"
#include "vikslippymapsource.h"
#include "map_ids.h"

/* initialisation */
void openaip_init ()
{
VikMapSource *openaip_type = VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
"id", MAP_ID_OPENAIP,
"name", "OpenAIP",
"label", "OpenAIP",
"url", "https://api.tiles.openaip.net/api/data/openaip/%d/%d/%d.png?apiKey="VIK_CONFIG_OPENAIP_KEY,
"file-extension", ".png",
"zoom-min", 4,
"zoom-max", 14,
"copyright", "https://www.openaip.net",
"license", "CC BY-NC 4.0",
"license-url", "https://creativecommons.org/licenses/by-nc/4.0/",
NULL));

maps_layer_register_map_source (openaip_type);
}

28 changes: 28 additions & 0 deletions src/openaip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* viking -- GPS Data and Topo Analyzer, Explorer, and Manager
*
* Copyright (C) 2003-2005, Evan Battaglia <[email protected]>
* Copyright (C) 2008, Guilhem Bonnefille <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#ifndef __VIKING_OPENAIP_H
#define __VIKING_OPENAIP_H

void openaip_init ();

#endif