Closed johnd0e closed 5 years ago
There are currently two attempts to fix the problem.
Some links from former discussion:
@modos189 could you explain the reason for this change: https://github.com/IITC-CE/ingress-intel-total-conversion/commit/6d3e28493cf5ba1ecc59b8d3432f99f8501b3b53?
Also I'm interesting what is the source of transforming algorithm. I found similar:
And here are also different 'point-in-polygon' algorithm implementations: https://github.com/IITC-CE/ingress-intel-total-conversion/pull/65#issuecomment-455151352
@modos189 could you explain the reason for this change
Previously, the fix coordinates included most of India, all of South and North Korea, the Philippines, Vietnam, Mongolia, Thailand, and a number of other countries: http://programmerz.ru/images/76604/BG9LI.jpg
Code in https://github.com/IITC-CE/ingress-intel-total-conversion/commit/6d3e28493cf5ba1ecc59b8d3432f99f8501b3b53 more accurately indicates the borders of China, so as not to affect other countries. I took it here: https://github.com/iitc-project/ingress-intel-total-conversion/pull/1188
Here I managed to partially solve the problem.
BIG plus 1: Do not change the coordinates of portals BIG plus 2: No changes to other plugins are made
Minus: With a zoom of 16, to the right sometimes not loaded tiles. With a zoom of 18, this gets worse and the right side of the screen is already without tiles.
The fact is that due to the correction of coordinates the map moves and goes beyond the boundaries for which the tiles are loaded.
By the way, now the correction of coordinates applies to all maps (except satellite and hybrid)
Is it possible to provide this solution to other basemap-plugins?
Code in 6d3e284 more accurately indicates the borders of China
So there is complex polygon now. Doesn't it affect the performance? Or maybe better make 2-steps check?
edit: I see isInGoogle
is that 1st step that I mean.
the right side of the screen is already without tiles.
Do you have ideas how to fix it?
Also I'm interesting what is the source of transforming algorithm.
Well, I see that the source is mentioned in that PR:
// The algorithm of transforming WGS-84 to GCJ-02 comes from:
// https://on4wp7.codeplex.com/SourceControl/changeset/view/21483#353936
So I wonder why these lines were removed?
P.S. Just for reference: here are related author's blog's entries:
Is it possible to provide this solution to other basemap-plugins?
Yep, that's what I want to do.
So there is complex polygon now. Doesn't it affect the performance?
Visually, I do not notice the difference.
edit: I see
isInGoogle
is that 1st step that I mean.
I don't know what that is. And it's not used anywhere.
the right side of the screen is already without tiles.
Do you have ideas how to fix it?
I fixed this in all maps except Google. Now I do not know how to fix
So I wonder why these lines were removed?
Mistakenly deleted. Now returned.
I found error in the code (mistype). Also I have concerns about some style's elements. So I will prepare PR.
Since there are both maps that require coordinate correction and those that do not require it, I suggest pass an optional parameter when initializing the map. Example:
var mapLayer = new L.TileLayer(baseUrl + address, {
attribution: 'map tiles by autonavi.com, plugin written by GMOogway.',
subdomains: '1234',
layer: layer,
type: '',
minZoom: minZoom,
maxNativeZoom: maxZoom,
maxZoom: 20,
needFixChinaOffset: true
});
layerChooser.addBaseLayer(mapLayer, '高德 ' + name);
I found a solution to fix google maps
I suggest pass an optional parameter when initializing the map.
I would be perfect solution.
But I still have concerns about leaflet monkey-patching in fix-googlemap-china-offset
script.
I wonder if it could be implemented via leaflet plugin instead.
We need to make here a list of known maptiles providers, in order to check:
Even more, we need 2 lists: first for providers included with iitc, and second for all others.
Included:
satellite
and hybrid
)Chinese:
Others:
@johnd0e Hong Kong and Macau: WGS84 google map(except satellite and hybrid): gcj02 baidu map: bd09 gaode map and other china maps: gcj02 all the other maps are correct.
Hong Kong and Macau: WGS84
There could be difference depending on map. In current code (#72) HK positions are also processed for Baidu map. So we really need to check HK for every Chinese map, to make sure that it's Baidu-only.
gaode map and other china maps: gcj02
We also need to check all their variations (incl. satellite/hybrid). Do you have sample plugins for other china maps?
all the other maps are correct.
According Wikipedia Here are also in GSJ02. Could you check it?
Hong Kong and Macau: WGS84
There could be difference depending on map. In current code (#72) HK positions are also processed for Baidu map. So we really need to check HK for every Chinese map, to make sure that it's Baidu-only.
gaode map and other china maps: gcj02
Do you have sample plugins for other china maps?
all the other maps are correct.
According Wikipedia Here are also in GSJ02. Could you check it?
Too complicated? I think we can use gedo-map + fix-china-map-gcj02-offset in China. Otherwise, we can use Google map directly without fix-china-map-gcj02-offset. We don't use baidu-map (bd09), and now baidu-map can't be displayed in intel.
baidu map in intel:
Otherwise, we can use Google map directly without fix-china-map-gcj02-offset
We fix-china-map-offset for Google, don't we?
baidu map in intel:
How have you got this screen?
We fix-china-map-offset for Google, don't we?
yes, but if I have gaode map in china, why use google map? google map update is not in timely, In China, gaode map is enough.
How have you got this screen?
I used the same method as gaode map, but it didn't display correctly.
gaode map is enough
Ok. And what is difference between 'gaode' and 'autonavi'?
I used the same method as gaode map, but it didn't display correctly.
May be this can help: https://github.com/muyao1987/leaflet-tileLayer-baidu
Ok. And what is difference between 'gaode' and 'autonavi'?
gaode=autonavi ^^
May be this can help: https://github.com/muyao1987/leaflet-tileLayer-baidu
ok
Interesting, there is official converting api:
May be to use 2 parameters in which to pass a list of layers that need correction?
needFixChinaGCJ02Offset: ['roads']
or
needFixChinaBD09Offset: ['roads']
// only for baidu
May be to use 2 parameters in which to pass a list of layers that need correction?
As I stated here https://github.com/IITC-CE/ingress-intel-total-conversion/pull/72#issuecomment-455914716, we need to test some real maps before we could make proper decisions.
hybrid
and satellite
excludes internal (for google), and not expose any option for this.Fixed by #68
Background info:
Summary: some map tiles providers use GCJ-02 coordinates, thus map appears with some offset.
_Originally posted by @modos189 in https://github.com/_render_node/MDExOlB1bGxSZXF1ZXN0MjQ0Njc3OTI3/pull_requests/unread_timeline#issuecomment-454773564_