Skip to content

Commit e200f6d

Browse files
committed
Fixed voor no-hp support
1 parent fc6ba31 commit e200f6d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

mapcodelib/mapcoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <ctype.h> // toupper
2020
#include "mapcoder.h"
2121

22-
#define SUPPORT_HIGH_PRECISION
22+
#undef SUPPORT_HIGH_PRECISION
2323

2424
/*
2525
no threadsafe:

utility/mapcode.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ static void usage(const char* appName) {
8080
printf("MAPCODE (version %s)\n", mapcode_cversion);
8181
printf("Copyright (C) 2014-2015 Stichting Mapcode Foundation\n");
8282
printf("\n");
83+
#ifndef SUPPORT_HIGH_PRECISION
84+
printf("Warning: High precision support is disabled in this build.)\n\n");
85+
#endif
8386
printf("Usage:\n");
8487
printf(" %s [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]\n", appName);
8588
printf("\n");
@@ -292,6 +295,16 @@ static void generateAndOutputMapcodes(double lat, double lon, int iShowError, in
292295
lat += 180;
293296
}
294297

298+
#ifndef SUPPORT_HIGH_PRECISION
299+
{
300+
// Need to truncate lat/lon to microdegrees.
301+
long intLon = lon * 1000000.0;
302+
long intLat = lat * 1000000.0;
303+
lon = (intLon / 1000000.0);
304+
lat = (intLat / 1000000.0);
305+
}
306+
#endif
307+
295308
const int nrResults = encodeLatLonToMapcodes(results, lat, lon, context, extraDigits);
296309
if (nrResults <= 0) {
297310
if (iShowError) {

0 commit comments

Comments
 (0)