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

Trim unnecessary coordinate precision? #357

Closed
tmcw opened this issue Apr 24, 2016 · 5 comments
Closed

Trim unnecessary coordinate precision? #357

tmcw opened this issue Apr 24, 2016 · 5 comments

Comments

@tmcw
Copy link
Collaborator

tmcw commented Apr 24, 2016

from @mourner 's comment at

turf-junkyard/turf-hex-grid#19


The current code generates unnecessarily detailed coordinates because there's no rounding:

[-95.59408416187462, 31.27105676807148],
[-95.80518167741707, 31.58431182228841]
We should round to at least 7-8 digits.


I'm not sure that this makes sense... why should we limit coordinate precision?

@mourner
Copy link
Contributor

mourner commented Apr 24, 2016

Because 7th digit has a maximum margin of error that equals 11mm on the equator. We have 14 digits, half of them are simply unnecessary, leading to 2 times bigger sizes of GeoJSON when saved to a file. Although maybe this should be done as a post-processing step with a separate JS module, not as a part of each individual module, most users are unaware of the unnecessary digits.

@tmcw
Copy link
Collaborator Author

tmcw commented Apr 25, 2016

Yeah, I think this should be in a separate module - the space savings only happens when serializing out geojson, and often turf-using applications don't serialize at all/save to disk, or have lots of temporary results that aren't ever saved.

@wboykinm
Copy link

wboykinm commented May 20, 2016

I'm hitting file transfer limits when I run my 6-points-of-precision geojson through turf and get 14 points back. Even a separate module in turf for this would be fabulous, though for the moment there's this.

@mourner
Copy link
Contributor

mourner commented May 20, 2016

@wboykinm just realized that you can probably do without a separate module:

var meta = require('turf-meta');

meta.coordEach(geojson, function (p) {
    p[0] = Math.round(p[0] * 1e6) / 1e6;
    p[1] = Math.round(p[1] * 1e6) / 1e6;
});

@mourner mourner closed this as completed May 20, 2016
@wboykinm
Copy link

SO EASY

s-pic referenced this issue in FixMyBerlin/fixmy.frontend Mar 7, 2020
In order to let us configure and build the platform for new regions, this PR adds a new environment variable `REGION_ENV`. When set, it causes replacement configuration options to be loaded. As an example, this PR adds configurations that enable only the Meldedialog for `REGION_ENV=bonn`.

The new region can be activated with the new commands

- npm start:bonn
- npm dev:bonn
- npm build:bonn

Closes FixMyBerlin/fixmy.platform#262

* Extend config for region-specific setup
* Add geojson boundary for sample region
* Disable subpages when their routes are not configured
* Add instance-specific configuration for reports feature
* Add build command for sample new region
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants