Skip to content
Commits on Source (11)
# Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
# Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......
Original C library created by Pieter Geelen. Work on Java version
of the Mapcode library by Rijn Buve (original port by Matthew Lowden).
Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
# Mapcode Library for C/C++
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d2e3d7a469484bfd8b801ce94d3f1737)](https://www.codacy.com/app/rijnb/mapcode-cpp?utm_source=github.com&utm_medium=referral&utm_content=mapcode-foundation/mapcode-cpp&utm_campaign=Badge_Grade)
[![License](http://img.shields.io/badge/license-APACHE2-blue.svg)]()
**Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)**
**Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)**
**Online documentation: http://mapcode-foundation.github.io/mapcode-cpp/**
......@@ -64,7 +65,7 @@ decode Mapcodes.
This produces the following help text:
MAPCODE (version 2.5.2)
Copyright (C) 2014-2016 Stichting Mapcode Foundation
Copyright (C) 2014-2017 Stichting Mapcode Foundation
Usage:
mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
......@@ -176,8 +177,83 @@ To add individual support support for other languages (of all territory names),
The list of support languages may grow over time.
## Using the C Library in an Xcode iOS Swift project
You can use this C library in an iOS application, built with Swift in Xcode, fairly easily.
All you need to do is:
First, copy the directory `mapcodelib` to the source directory of your iOS application.
Then, add a text file called `module.modulemap` in the directory `mapcodelib` to export all symbols
from the C library to Swift (note that `#defines` are not exported):
```
module mapcodelib [system][extern_c]{
header "mapcode_alphabets.h"
header "mapcode_territories.h"
header "mapcoder.h"
export *
}
```
Now, you can access the C library methods like this in a Swift project:
```
// Example of decoding a full mapcode to a lat/lon:
let territory = getTerritoryCode(context, TERRITORY_NONE)
var lat: Double = 0.0
var lon: Double = 0.0
let mapcodeError = decodeMapcodeToLatLonUtf8(&lat, &lon, fullMapcode, territory, nil)
if mapcodeError == ERR_OK {
// Use the decoded lat and lon.
} else {
// Something went wrong decoding the full mapcode string.
}
```
Or encode a latitude, longitude pair to a set of Mapcodes like this:
```
let buffer = UnsafeMutablePointer<Int8>.allocate(capacity: Int(_MAX_MAPCODE_RESULT_ASCII_LEN))
buffer.initialize(to: 0, count: Int(_MAX_MAPCODE_RESULT_ASCII_LEN))
var total: Int32 = 0;
var i: Int32 = 0
repeat {
total = encodeLatLonToSelectedMapcode(buffer, lat, lon, TERRITORY_NONE, 0, i)
if (total > 0) {
let mapcode = String.init(cString: buffer);
}
i = i + 1
} while (i < total)
```
Or get a territory name like this:
```
let buffer = UnsafeMutablePointer<CChar>.allocate(capacity: Int(MAX_TERRITORY_FULLNAME_UTF8_LEN + 1))
buffer.initialize(to: 0, count: Int(_MAX_TERRITORY_FULLNAME_UTF8_LEN + 1))
// Get alpha code.
getTerritoryIsoName(buffer, TERRITORY_NLD, 0)
let alphaCode = String.init(cString: buffer)
// Get full name.
getFullTerritoryNameEnglish(buffer, TERRITORY_NLD, 0)
let fullName = String.init(cString: buffer)
```
## Release Notes
### 2.5.4 - 2.5.5
* Added `encodeLatLonToSelectedMapcode` as a convenience for languages that use the
C library, but have difficulties dealing with multi-dimensional arrays (like Swift).
### 2.5.3
* Cleaned up code after running Codacy code reviews.
* Fixed copyright message.
### 2.5.2
* Added unit test for floating point error with code "40822.schol".
......
mapcode (2.5.2-2) UNRELEASED; urgency=medium
mapcode (2.5.5-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Update copyright-format URL to use HTTPS.
* Update copyright years for Stichting Mapcode Foundation.
* Restructure control file with cme.
* Bump Standards-Version to 4.1.3, no changes.
* Enable all hardening buildflags.
* Add autopkgtest to test installability.
* Add lintian override for spelling-error-in-binary false positive.
-- Stefan Fritsch <sf@debian.org> Sun, 21 Jan 2018 10:58:16 +0100
-- Bas Couwenberg <sebastic@debian.org> Sun, 28 Jan 2018 19:12:25 +0100
mapcode (2.5.2-1) unstable; urgency=medium
......
......@@ -5,14 +5,14 @@ Section: misc
Priority: optional
Build-Depends: debhelper (>= 9),
cmake (>= 3.3)
Standards-Version: 3.9.8
Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-grass/mapcode.git/
Vcs-Git: https://anonscm.debian.org/git/pkg-grass/mapcode.git
Homepage: http://www.mapcode.com/
Package: mapcode
Multi-Arch: foreign
Architecture: any
Multi-Arch: foreign
Depends: ${shlibs:Depends},
${misc:Depends}
Description: Convert geo coordinates to/from mapcodes
......
......@@ -4,7 +4,7 @@ Upstream-Contact: http://www.mapcode.com/
Source: https://github.com/mapcode-foundation/mapcode-cpp/releases
Files: *
Copyright: © 2014-2016, Stichting Mapcode Foundation (http://www.mapcode.com)
Copyright: © 2014-2017, Stichting Mapcode Foundation (http://www.mapcode.com)
License: Apache-2.0
Files: debian/*
......
# False positive on: Việt Nam
mapcode: spelling-error-in-binary usr/bin/mapcode Nam Name
......@@ -2,6 +2,9 @@
# DH_VERBOSE := 1
# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# some helpful variables - uncomment them if needed
# shamelessly stolen from http://jmtd.net/log/awk/
#DEBVERS := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
......
# Test installability
Depends: @
Test-Command: /bin/true
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......
/*
* Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2017 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......