Giter Site home page Giter Site logo

munterfi / flexpolyline Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 0.0 10.54 MB

The flexpolyline R package provides a binding to the C++ implementation of the flexible polyline encoding by HERE. The encoding is a lossy compressed representation of a list of coordinate pairs or coordinate triples.

Home Page: https://munterfi.github.io/flexpolyline/

License: GNU General Public License v3.0

R 31.64% C++ 68.36%
polyline polyline-encoder polyline-decoder rspatial rstats gis heremaps

flexpolyline's People

Contributors

meiertobias avatar munterfi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flexpolyline's Issues

Bug: CRAN notes

CRAN shows notes for devel versions:

Version: 0.2.1
Check: LazyData
Result: NOTE
     'LazyData' is specified without a 'data' directory
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-ix86+x86_64, r-devel-windows-x86_64-gcc10-UCRT

Remove LazyData: true from the DESCRIPTION file to avoid the note.

Bug: Switch to HTML5 for documentation pages.

Describe the bug

Dear maintainer,

Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_flexpolyline.html>.

In particular, please see the "Found the following HTML validation
problems" NOTEs in the "HTML version of manual" check for the r-devel
debian checks results.  

R 4.2.0 switched to use HTML5 for documentation pages.  Now validation
using HTML Tidy finds problems in the HTML generated from your Rd files
of the form

 <big> element removed from HTML5
 <center> element removed from HTML5
 <img> attribute "align" not allowed for HTML5
 <img> attribute "hspace" not allowed for HTML5
 <img> attribute "width" has invalid value "120px"
 <img> attribute "width" has invalid value "480px"
 <img> attribute "width" has invalid value "50px"
 <img> attribute "width" has invalid value "72px"

For the first four, please see
<https://html.spec.whatwg.org/#obsolete-but-conforming-features> for
info on these: in principle, all can be fixed by using style attributes,
e.g.

 style='text-align: right;'

instead of align='right' etc., which will work for both the new and old
ways of converting Rd to HTML.

For the second four, simply drop the px units: the HTML5 standard asks
for a non-negative integer implied to be in CSS pixels.

Can you please fix as necessary?

Note that the problems are found in Rd files auto-generated with
roxygen2: to fix it might suffice to re-generate these using the current
CRAN version of roxygen2.

Please correct before 2022-09-01 to safely retain your package on CRAN.

Best,
-k

To Do:

  • Remove pixel units.
  • Replace align and width attributes with a style="..." attribute.

Bug: CRAN error

CRAN checks encounter new errors due to differences in rounding at high precisions on different platforms:

Additional issues
M1mac noLD

Check Details
Version: 0.2.1
Check: LazyData
Result: NOTE
     'LazyData' is specified without a 'data' directory
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-windows-ix86+x86_64, r-devel-windows-x86_64-gcc10-UCRT

Version: 0.2.2
Check: running tests for arch ‘i386’
Result: ERROR
     Running 'testthat.R' [9s]
    Running the tests in 'tests/testthat.R' failed.
    Complete output:
     > library(testthat)
     > library(flexpolyline)
     >
     > test_check("flexpolyline")
     == Skipped tests ===============================================================
     * On CRAN (1)
    
     == Failed tests ================================================================
     -- Failure (test-cpp_binding.R:73:3): Cpp binding to 'flexpolyline.h' en- and decodes correctly --
     any(...) not equal to FALSE.
     1 element mismatch
    
     [ FAIL 1 | WARN 0 | SKIP 1 | PASS 23 ]
     Error: Test failures
     Execution halted
Flavor: r-oldrel-windows-ix86+x86_64

Solution: Deactivate decoding and encoding tests on CRAN, as the deviations are marginal.

Bug: Failing check on CRAN

Package tests fail on CRAN for flavor r-oldrel-macos-x86_64:

Version: 0.2.0 
Check: tests 
Result: ERROR 
     Running ‘testthat.R’ [6s/6s]
    Running the tests in ‘tests/testthat.R’ failed.
    Last 13 lines of output:
     Message: c++ exception (unknown reason)
     Expected match: "Invalid input name of third dimension"
     Actual message: "c++ exception (unknown reason)"
     Backtrace:
     █
     1. ├─testthat::expect_error(...) test-cpp_binding.R:9:2
     2. │ └─testthat:::quasi_capture(...)
     3. │ ├─testthat:::.capture(...)
     4. │ │ └─base::withCallingHandlers(...)
     5. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
     6. └─flexpolyline::set_third_dimension(...)
     
     [ FAIL 6 | WARN 0 | SKIP 0 | PASS 24 ]
     Error: Test failures
     Execution halted 
Flavor: r-oldrel-macos-x86_64

Bug: Missing inclusion of <cstdint>

CRAN packages missing inclusion of <cstdint>.

Tests as for fedora-gcc but with GCC trunk aka pre-13.0.0 -- the
logs record the snapshot used..

Further details as 

https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-gcc

Reports that types such as uint64_t are undeclared indicate that header
<cstdint> (C++) or <stdint.h> (C) have not been included explicitly --
they are presumably included by some other header on earlier versions of gcc,
or by other compilers or platforms.
* using log directory ‘/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline.Rcheck’
* using R Under development (unstable) (2022-12-25 r83502)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (GCC) 13.0.0 20221225 (experimental)
    GNU Fortran (GCC) 13.0.0 20221225 (experimental)
* running under: Fedora Linux 36 (Workstation Edition)
* using session charset: UTF-8
* using option ‘--no-stop-on-test-error’
* checking for file ‘flexpolyline/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘flexpolyline’ version ‘0.2.6’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘flexpolyline’ can be installed ... [23s/24s] ERROR
Installation failed.
See ‘/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline.Rcheck/00install.out’ for details.
* DONE

Status: 1 ERROR
See
  ‘/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline.Rcheck/00check.log’
for details.

Command exited with non-zero status 1
Time 0:27.82, 23.69 + 1.81
* installing *source* package ‘flexpolyline’ ...
** package ‘flexpolyline’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 13.0.0 20221225 (experimental)’
using C++11
make[1]: Entering directory '/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline/src'
/usr/local/gcc13/bin/g++ -std=gnu++11 -I"/data/gannet/ripley/R/R-gcc13/include" -DNDEBUG  -I'/data/gannet/ripley/R/test-dev/Rcpp/include' -I/usr/local/include   -I../inst/include -fpic  -g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-parentheses -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection  -c RcppExports.cpp -o RcppExports.o
/usr/local/gcc13/bin/g++ -std=gnu++11 -I"/data/gannet/ripley/R/R-gcc13/include" -DNDEBUG  -I'/data/gannet/ripley/R/test-dev/Rcpp/include' -I/usr/local/include   -I../inst/include -fpic  -g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-parentheses -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection  -c flexpolyline.cpp -o flexpolyline.o
In file included from flexpolyline.cpp:1:
../inst/include/hf/flexpolyline.h:19:7: error: 'uint8_t' does not name a type
   19 | const uint8_t FORMAT_VERSION=1;
      |       ^~~~~~~
../inst/include/hf/flexpolyline.h:16:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   15 | #include <tuple>
  +++ |+#include <cstdint>
   16 | 
../inst/include/hf/flexpolyline.h:103:73: error: 'uint32_t' has not been declared
  103 |   bool inline static decode_unsigned_varint(const std::string& encoded, uint32_t& index, uint32_t length, int64_t& result) {
      |                                                                         ^~~~~~~~
../inst/include/hf/flexpolyline.h:103:90: error: 'uint32_t' has not been declared
  103 |   bool inline static decode_unsigned_varint(const std::string& encoded, uint32_t& index, uint32_t length, int64_t& result) {
      |                                                                                          ^~~~~~~~
../inst/include/hf/flexpolyline.h:131:49: error: 'uint32_t' has not been declared
  131 |   bool decode_value(const std::string& encoded, uint32_t& index, uint32_t length, double& result) {
      |                                                 ^~~~~~~~
../inst/include/hf/flexpolyline.h:131:66: error: 'uint32_t' has not been declared
  131 |   bool decode_value(const std::string& encoded, uint32_t& index, uint32_t length, double& result) {
      |                                                                  ^~~~~~~~
../inst/include/hf/flexpolyline.h: In static member function 'static void encoder::Converter::encode_unsigned_varint(int64_t, std::string&)':
../inst/include/hf/flexpolyline.h:78:7: error: 'uint8_t' was not declared in this scope
   78 |       uint8_t pos = (value & 0x1F) | 0x20;
      |       ^~~~~~~
../inst/include/hf/flexpolyline.h:78:7: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:79:39: error: 'pos' was not declared in this scope; did you mean 'pow'?
   79 |       result.push_back(ENCODING_TABLE[pos]);
      |                                       ^~~
      |                                       pow
../inst/include/hf/flexpolyline.h: In member function 'void encoder::Converter::encode_value(double, std::string&)':
../inst/include/hf/flexpolyline.h:93:24: error: 'uint64_t' was not declared in this scope
   93 |     delta = (int64_t)((uint64_t)delta << 1); // Mod: Use explicit casts of 'delta <<= 1;' to avoid UBSAN 'left shift of negative value'
      |                        ^~~~~~~~
../inst/include/hf/flexpolyline.h:93:24: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:93:33: error: expected ')' before 'delta'
   93 |     delta = (int64_t)((uint64_t)delta << 1); // Mod: Use explicit casts of 'delta <<= 1;' to avoid UBSAN 'left shift of negative value'
      |                                 ^~~~~
../inst/include/hf/flexpolyline.h:93:22: note: to match this '('
   93 |     delta = (int64_t)((uint64_t)delta << 1); // Mod: Use explicit casts of 'delta <<= 1;' to avoid UBSAN 'left shift of negative value'
      |                      ^
../inst/include/hf/flexpolyline.h: In member function 'void encoder::Encoder::encode_header(int, int, int)':
../inst/include/hf/flexpolyline.h:173:5: error: 'uint16_t' was not declared in this scope
  173 |     uint16_t res = (third_dim_precision << 7) | (third_dim << 4) | precision;
      |     ^~~~~~~~
../inst/include/hf/flexpolyline.h:173:5: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:175:43: error: 'FORMAT_VERSION' is not a member of 'hf'
  175 |     Converter::encode_unsigned_varint(hf::FORMAT_VERSION, m_result);
      |                                           ^~~~~~~~~~~~~~
../inst/include/hf/flexpolyline.h:176:39: error: 'res' was not declared in this scope
  176 |     Converter::encode_unsigned_varint(res, m_result);
      |                                       ^~~
../inst/include/hf/flexpolyline.h: At global scope:
../inst/include/hf/flexpolyline.h:209:3: error: 'uint32_t' does not name a type
  209 |   uint32_t m_index;
      |   ^~~~~~~~
../inst/include/hf/flexpolyline.h:209:3: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:237:76: error: 'uint32_t' has not been declared
  237 |   void inline static decode_header_from_string(const std::string& encoded, uint32_t& index, uint32_t length, uint16_t& header) {
      |                                                                            ^~~~~~~~
../inst/include/hf/flexpolyline.h:237:93: error: 'uint32_t' has not been declared
  237 |   void inline static decode_header_from_string(const std::string& encoded, uint32_t& index, uint32_t length, uint16_t& header) {
      |                                                                                             ^~~~~~~~
../inst/include/hf/flexpolyline.h:237:110: error: 'uint16_t' has not been declared
  237 |   void inline static decode_header_from_string(const std::string& encoded, uint32_t& index, uint32_t length, uint16_t& header) {
      |                                                                                                              ^~~~~~~~
../inst/include/hf/flexpolyline.h: In constructor 'encoder::Decoder::Decoder(std::string)':
../inst/include/hf/flexpolyline.h:220:34: error: class 'encoder::Decoder' does not have any field named 'm_index'
  220 |   m_encoded{std::move(encoded)}, m_index{0}, m_length{m_encoded.length()}
      |                                  ^~~~~~~
../inst/include/hf/flexpolyline.h: In static member function 'static void encoder::Decoder::decode_header_from_string(const std::string&, int&, int, int&)':
../inst/include/hf/flexpolyline.h:241:22: error: 'FORMAT_VERSION' is not a member of 'hf'
  241 |     if (value != hf::FORMAT_VERSION) throw std::invalid_argument("Invalid format version");
      |                      ^~~~~~~~~~~~~~
../inst/include/hf/flexpolyline.h: In member function 'void encoder::Decoder::decode_header()':
../inst/include/hf/flexpolyline.h:249:5: error: 'uint16_t' was not declared in this scope
  249 |     uint16_t header = 0;
      |     ^~~~~~~~
../inst/include/hf/flexpolyline.h:249:5: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:250:42: error: 'm_index' was not declared in this scope
  250 |     decode_header_from_string(m_encoded, m_index, m_length, header);
      |                                          ^~~~~~~
../inst/include/hf/flexpolyline.h:250:61: error: 'header' was not declared in this scope
  250 |     decode_header_from_string(m_encoded, m_index, m_length, header);
      |                                                             ^~~~~~
../inst/include/hf/flexpolyline.h: In member function 'bool encoder::Decoder::decode_one(double&, double&, double&)':
../inst/include/hf/flexpolyline.h:258:9: error: 'm_index' was not declared in this scope
  258 |     if (m_index == m_length) return false;
      |         ^~~~~~~
../inst/include/hf/flexpolyline.h:259:45: error: 'm_index' was not declared in this scope
  259 |     if (!m_lat_conv.decode_value(m_encoded, m_index, m_length, lat)) throw std::invalid_argument("Invalid encoding");
      |                                             ^~~~~~~
../inst/include/hf/flexpolyline.h:260:45: error: 'm_index' was not declared in this scope
  260 |     if (!m_lng_conv.decode_value(m_encoded, m_index, m_length, lng)) throw std::invalid_argument("Invalid encoding");
      |                                             ^~~~~~~
../inst/include/hf/flexpolyline.h:262:45: error: 'm_index' was not declared in this scope
  262 |       if (!m_z_conv.decode_value(m_encoded, m_index, m_length, z)) throw std::invalid_argument("Invalid encoding");
      |                                             ^~~~~~~
../inst/include/hf/flexpolyline.h: In function 'hf::ThirdDim hf::get_third_dimension(const std::string&)':
../inst/include/hf/flexpolyline.h:301:3: error: 'uint32_t' was not declared in this scope
  301 |   uint32_t index=0;
      |   ^~~~~~~~
../inst/include/hf/flexpolyline.h:301:3: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:302:3: error: 'uint16_t' was not declared in this scope
  302 |   uint16_t header;
      |   ^~~~~~~~
../inst/include/hf/flexpolyline.h:302:3: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
../inst/include/hf/flexpolyline.h:304:56: error: 'index' was not declared in this scope
  304 |   encoder::Decoder::decode_header_from_string(encoded, index, length, header);
      |                                                        ^~~~~
../inst/include/hf/flexpolyline.h:304:71: error: 'header' was not declared in this scope
  304 |   encoder::Decoder::decode_header_from_string(encoded, index, length, header);
      |                                                                       ^~~~~~
make[1]: *** [/data/gannet/ripley/R/R-gcc13/etc/Makeconf:183: flexpolyline.o] Error 1
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline/src'
ERROR: compilation failed for package ‘flexpolyline’
* removing ‘/data/gannet/ripley/R/packages/tests-gcc13/flexpolyline.Rcheck/flexpolyline’

Polygon Support

Add support for geometry type "POLYGON" in encode_sf() and decode_sf().

In the coordinates matrix of polygons the last row is idental with the first row. This property will be used to check for polygons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.