Skip to content

Commit

Permalink
1.0.0 - localize (#127)
Browse files Browse the repository at this point in the history
* add internationalize function

* add InternationalizeBatonType and Worker

* [breaking] update module exports

* add internationalize param validation tests

* add internationalize logic

* add internationalize tests

* require language to be a non-empty string

* update mvt-fixtures

* assume name_local isnt in source data

* support null value for internationalize language

* clang tidy

* 1.0.0-dev0 [publish binary]

* upgrade tests for @mapbox/mvt-fixtures@3.7.0

* address comments

* Update src/vtcomposite.cpp

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update src/vtcomposite.cpp

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* update tests

* add name_local to all internationalized requests

* 1.0.0-dev1 [publish binary]

* Add worldview support to internationalize function (#120)

* 1st pass at adding worldview into params

* - basic worldview support

* [publish binary] 1.0.0-dev2

* - adds support for comma-separated worldviews

* [publish binary] 1.0.0-dev3

* testing changes:
- combine lang + worldview
- verify ID is not added
- check geometry

* linting internationalize test

* moving test util function

* readme tweaks;

* removing todo comments

* very wip to replicate legacy worldview features

* wip2]

* cleanup cleanup everybody everywhere

* i18n worldview tests

* uncomment binding

* tidy and format

* v1.0.0-dev4 [publish binary]

* uncomment binding [publish binary]

* test with whacky/mismatching worldview values

* update and split docs

* update xcode12.4 and remove CXX flags

* revert xcode changes

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* utils functions for split and intersect

* uncomment binding.gyp

* std::begin -> begin() / end(), var renaming

* swap order of build_internationalized_feature parameters

* tidy and format

* revert clang versions

* 1.0.0-dev5 [publish binary]

Co-authored-by: mapsam <matthews.sam@gmail.com>
Co-authored-by: Sam Matthews <sam@mapbox.com>

* internationalize -> localize (#121)

* internationalize -> localize

* uncomment binding

* Update src/vtcomposite.cpp

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update src/vtcomposite.cpp

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* 1.0.0-dev6 [publish binary]

* Update README.md

Co-authored-by: Rajesh Amradi <rajesh.amradi@mapbox.com>

* use mvt-fixtures 3.8.0

Co-authored-by: John Klancer <john.klancer@mapbox.com>
Co-authored-by: Rajesh Amradi <rajesh.amradi@mapbox.com>

* configurable worldview settings (#123)

* localize(params), worldview_property option

* worldview_defaults, tests with inline mvt fixtures

* use mvt-fixtures 3.9.0

* update README

* remove worldview_defaults param, update readme + tests

* update param validation tests

* review feedback

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* Update README.md

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* tidy and format

* 1.0.0-dev7 [publish binary]

Co-authored-by: John Klancer <john.klancer@mapbox.com>

* configurable language settings (#125)

* language_property, language_prefix

* add params.language_property and params.language_prefix test

* add language params docs

* make format

* fix test name

* 1.0.0-dev8 [publish binary]

* test for >2 chars (#126)

* 1.0.0 [publish binary]

Co-authored-by: gerdie <maria.moy@mapbox.com>
Co-authored-by: John Klancer <john.klancer@mapbox.com>
Co-authored-by: Rajesh Amradi <rajesh.amradi@mapbox.com>
  • Loading branch information
4 people authored Jul 15, 2022
1 parent ffdea5a commit 0ea5136
Show file tree
Hide file tree
Showing 21 changed files with 4,537 additions and 556 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
lib/binding
node_modules
build
mason_packages
.DS_Store
*tgz
.vscode
*.profdata
*.profraw
*tgz
build
lib/binding
mason_packages
node_modules
npm-debug.log
viz/index.html
viz/index.html
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# 1.0.0

**BREAKING** Module now returns an object with two functions [#127](https://github.com/mapbox/vtcomposite/pull/127)

```js
const { composite, localize } = require('@mapbox/vtcomposite');
```

- Adds a new function `localize` which finds and removes unused translations and worldviews from features.
- Update mvt-fixtures@3.9.0
- Update tape@4.15.1
- Move tutorial from README.md into TUTORIAL.md
- Move benchmarking from README.md into CONTRIBUTING.md


# 0.6.1
- Build binaries with node v16 -> works at runtime with node v8 -> v16 (and likely others)
- Remove `-D_GLIBCXX_USE_CXX11_ABI=0` build flag
Expand Down
86 changes: 81 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,88 @@
# Contributing

Thanks for getting involved and contributing to the skel :tada: Below are a few things to setup when submitting a PR.
Thanks for getting involved and contributing to vt-composite :tada: Below are a few things to setup when submitting a PR.

## Code comments
# Installation

Each `make` command is specified in [`Makefile`](./Makefile)

```bash
git clone git@github.com:mapbox/vtcomposite.git
cd vtcomposite

# Build binaries. This looks to see if there were changes in the C++ code. This does not reinstall deps.
make

# Run tests
make test

# Cleans your current builds and removes potential cache
make clean

# Cleans everything, including the things you download from the network in order to compile (ex: npm packages).
# This is useful if you want to nuke everything and start from scratch.
# For example, it's super useful for making sure everything works for Travis, production, someone else's machine, etc
make distclean

# This skel uses documentation.js to auto-generate API docs.
# If you'd like to generate docs for your code, you'll need to install documentation.js,
# and then add your subdirectory to the docs command in package.json
npm install -g documentation
npm run docs
```

# Benchmarks

Benchmarks can be run with the bench/bench.js script to test vtcomposite against common real-world fixtures (provided by mvt-fixtures) and to test vtcomposite against its predecessor compositing library node-mapnik. When making changes in a pull request, please provide the benchmarks from the master branch and the HEAD of your current branch. You can control the `concurrency`, `iterations`, and `package` of the benchmarks with the following command:

node bench/bench.js --iterations 1000 --concurrency 5 --package vtcomposite

And the output will show how many times the library was able to execute per second, per fixture:

1: single tile in/out ... 16667 runs/s (3ms)
2: two different tiles at the same zoom level, zero buffer ... 4167 runs/s (12ms)
3: two different tiles from different zoom levels (separated by one zoom), zero buffer ... 633 runs/s (79ms)
4: two different tiles from different zoom levels (separated by more than one zoom), zero buffer ... 1429 runs/s (35ms)
5: tiles completely made of points, overzooming, no properties ... 3846 runs/s (13ms)
6: tiles completely made of points, same zoom, no properties ... 50000 runs/s (1ms)
7: tiles completely made of points, overzoooming, lots of properties ... 3333 runs/s (15ms)
8: tiles completely made of points, same zoom, lots of properties ... 50000 runs/s (1ms)
9: buffer_size 128 - tiles completely made of points, same zoom, lots of properties ... 50000 runs/s (1ms)
10: tiles completely made of linestrings, overzooming and lots of properties ... 1163 runs/s (43ms)
11: tiles completely made of polygons, overzooming and lots of properties ... 254 runs/s (197ms)
12: tiles completely made of points and linestrings, overzooming and lots of properties ... 10000 runs/s (5ms)
13: returns compressed buffer - tiles completely made of points and linestrings, overzooming and lots of properties ... 5556 runs/s (9ms)
14: buffer_size 128 - tiles completely made of points and linestrings, overzooming and lots of properties ... 12500 runs/s (4ms)
15: tiles completely made of points and linestrings, overzooming (2x) and lots of properties ... 16667 runs/s (3ms)
16: tiles completely made of polygons, overzooming and lots of properties ... 1042 runs/s (48ms)
17: tiles completely made of polygons, overzooming (2x) and lots of properties ... 2174 runs/s (23ms)
18: return compressed buffer - tiles completely made of polygons, overzooming (2x) and lots of properties ... 2083 runs/s (24ms)
19: buffer_size 4096 - tiles completely made of polygons, overzooming (2x) and lots of properties ... 1087 runs/s (46ms)

# Viz

The viz/ directory contains a small node application that is helpful for visual QA of vtcomposite results. It requests a single Mapbox street tile at z6 and uses the `composite` function to overzoom the tile at `z7`. In order to request tiles, you'll need a `MapboxAccessToken` environment variable and you'll need to run both a local tile server and a simple server for your `viz` application.

```shell
cd viz
npm install
MapboxAccessToken={token} node app.js
# localhost:3000

#in a separate terminal tab, run a simple server on a port of your choosing
#navigate to this port in your browser
python -m SimpleHTTPServer x000
```

# Code comments

If adding new code, be sure to include relevant code comments. Code comments are a great way for others to learn from your code. This is especially true within the skeleton, since it is made for learning.

## Update Documentation
# Update Documentation

Be sure to update any documentation relevant to your change. This includes updating the [CHANGELOG.md](https://github.com/mapbox/node-cpp-skel/blob/master/CHANGELOG.md).

## [Code Formatting](/docs/extended-tour.md#clang-tools)
# [Code Formatting](/docs/extended-tour.md#clang-tools)

We use [this script](/scripts/clang-format.sh#L20) to install a consistent version of [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) to format the code base. The format is automatically checked via a Travis CI build as well. Run the following script locally to ensure formatting is ready to merge:

Expand All @@ -20,4 +92,8 @@ We also use [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) as a C++ li

make tidy

These commands are set from within [the Makefile](./Makefile).
These commands are set from within [the Makefile](./Makefile).

# Releasing

In short, you'll need to push a commit with the log line containing `[publish binary]` to build the binary, followed by an `npm publish`. See [node-cpp-skel](https://github.com/mapbox/node-cpp-skel/blob/d2848ed5bcc5a798ff39a2ac139b70844043ff11/docs/publishing-binaries.md) for all the details.
Loading

0 comments on commit 0ea5136

Please sign in to comment.