iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
989 stars 552 forks source link

Modify "China" boundary for offset fix plugin #1188

Open Artoria2e5 opened 7 years ago

Artoria2e5 commented 7 years ago

... and switch to a new implementation just for tidying up.

This commit should help unfortunate souls who enabled the plugin while in Viet Nam, Mongolia, or just HKSAR. (But well, my polygon is still an approximation, and folks near the borders will still see problems.)


I am not entirely sure about the "pnpoly" licensing. There is a MIT-licensed js implementation (https://github.com/substack/point-in-polygon) based on the documentation (dead, no archive) instead of the 8-line code, and I can switch to that if necessary.

Artoria2e5 commented 7 years ago

Tested and fixed...

breezewish commented 7 years ago

👍

Artoria2e5 commented 7 years ago

Should I bump the version to 0.0.2 or something?

Artoria2e5 commented 7 years ago

For future reproducibility, I grabbed a "SIMPL" borders shapefile from http://thematicmapping.org/downloads/world_borders.php (CC-BY-SA), fed it into http://www.mapshaper.org/, ran a pass of visvalingam (weighted) at 25%, dumped it as geojson and extracted the "China" bit. This gives a polygon with 197+8 (hainan) vertices, which should be possible to further reduce by running a heavier second pass at 50% or giving up precision around the coasts (doing this helps the islands too.)

This json comes from the first 25% pass on the whole-world map. Roughen it by a bit around the coasts, make it a single polygon, add some exceptions around Hong Kong and Macau -- that's all it takes to ready it for replacing the current magic values obtained from randomly eyeing on Google Earth.

TM_WORLD_BORDERS_SIMPL-0.3.zipCN.zip

The original SIMPL shapefile comes with a 285-vertex mainland with 31 smaller islands. Admittedly the simplification would be more straightforward if I have removed other countries in the first pass input.

johnd0e commented 5 years ago

@Artoria2e5 , could you tell more about differences between this patch and upstream. I see baidu-related stuff removed, anything else?

And is your code based on mentioned link https://on4wp7.codeplex.com/SourceControl/changeset/view/21483#353936 or not?

Artoria2e5 commented 5 years ago

The algorithm is based on that thing. Basically everything we know for sure about GCJ-02 is.

The upstream (also me) is basically this with baidu and some utility functions.

johnd0e commented 4 years ago

Recent fix in upstream: https://github.com/Artoria2e5/PRCoords/commit/026c571b528177ebb8fe0348474385298499c6b9#diff-de8eeac97a630cd112642780ec1d948cR124