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

bug: Google maps are offseted in China #670

Closed breezewish closed 10 years ago

breezewish commented 10 years ago

Hello.

I am a user from China.

Due to policy issues, in my country Google road maps have a large offset (while Google Satellite and other 3rd-party map providers don't). This is one of the main reason why everyone of we Chinese Ingress users use IITC just because the official map have offsets and the MapQuest map provided by IITC could relatively solve the problem.

But Google road map shows much more information than other map providers in China and we are still expecting to use Google road maps. So I wrote an IITC plugin which could fix the offset issue of Google Road map: https://github.com/breeswish/iitc-plugin-googlemap-offset-fixer .

I am going to contribute it to IITC, however you could see that, because of the lacking of interfaces for rewriting native IITC functions (in this case, Leaflet functions: L.Google), the plugin should hijack 'console.log' (Line28). I think this method is not friendly and graceful and obviously you may not want to see them while merging codes.

So could you first implement an interface (or event handler) in which plugins could rewrite IITC native functions before these functions are executed? After that, I could just modify my plugin and send a pull-request so that every China user could get the convenience (especially for those mobile IITC users because they cannot customize plugins).

Notice: Only China map have offsets and there are no accurate bounds, so I do not want to submit a pull-request which replace L.Google because it may cause new offsets in boundary areas of China. I think releasing this patch as a plugin is a good choice.

Thank you !

ToeBee commented 10 years ago

FYI, the MapQuest map tiles that IITC uses by default is actually the MapQuest Open product which uses data from OpenStreetMap so if the map is incomplete you can go add things to OpenStreetMap and they will show up on the MapQuest tiles within a very short time (sometimes minutes, sometimes a day or so, depending on server load). Then you can have both accurate and complete maps!

breezewish commented 10 years ago

@ToeBee I am sorry but.. You know in China there is a great fire wall, many many service are just blocked, (ingress too) and we have already had many great map services(Google/Baidu), so we are expecting nothing to develop these 3rd party map services. in short time even in long time this situation will not be changed.

more, For example, the map of OpenStreetMap do shows metro lines of Shanghai but they have no colors or names, so it is nearly nothing help. Further more, OSM lacks data of many many China cities. But it is very different in Google map, we Chinese users can get everything from it. If Google maps have no offset, we will all choose it obviously. This seems sad but the environment determined this result and we cannot change it. We cannot access Facebook Twitter Youtube, we have better alternatives so little chinese people use them. That is the same to OSM. We dont know what can we get from contributing to OSM because it is ILEGLE in our country and at everytime it may get banned. The open spirit in our country is very young.

So we are all expecting IITC could fix Google map offset issue of China (and we do fixed it, just waiting for an interface for a better code arrangement). Please, consider our bad situation :) Thank you.

katpatuka commented 10 years ago

OSM lives and dies with contributers who best know their country and their neighborhood. I have been editing a lot in China - because I'm living outside the country I don't have to fear anything. But: I do not speak Chinese; I have a hard time to find good sources and: I have only 2 hands! If only 100 of the 1,350,695,000 population of China would start to constantly contribute to make the China map that would be fantastic!

breezewish commented 10 years ago

@katpatuka That's right, I love open (source) stuff also. I admit it is better to use OSM. But our condition is not the same as yours. You have already have an OK Google Map, and a good OSM, so you are contributing to OSM to make things better. But we are, we even do not have an OK Google Map, and have a poor OSM, so we should first solve Google Map (only have offset problems) and then if we have time we like to contribute to OSM. That's like, we should first ensure enough food before considering how to eat better.

Currently, OSM map of Shanghai are lack of public transportations. This limited our activities a lot (without offset-fix plugin I write). We have to find nearby street names and then use Google Map or Baidu Map to find where it is and find how to go there. Well, that place are far from metro? Ok, find another destination in IITC, then find it in Google map ....

You know, many Chinese players do not have a car, so we heavily rely on public transportations. OSM map do tell us where the portal is but it cannot tell us how can we go there. That is not good. The worse fact is, more Chinese people use Baidu Maps (the very top search engine in China. Yes not Google because Google is blocked). They even do not know Google map, not to mention OSM. So I really do not think OSM could be better or even as good as Baidu/Google map in China in many years. Little data, may blocked, illegal, nearly no other contributors. It is a bad loop currently. Baidu staffs are very active. We can easily submit shop request on Baidu Map. Baidu map is free (not open) also. No request times limit like Google. Also it is better than Google map, far more better than OSM. This is a really sad fact but we cannot change it. We are used to live in a place where Twitter, Facebook, Youtube, and part of Wikipedia and Google are blocked. We all have a better alternative and we live well.

Also, contributing to OSM cannot fix the issue that Google maps are offseted in China. The bug does exist. It is a fact. As far as IITC provides Google map view, it should be OK. Developers cannot make users' choice: "well, OSM is good, OSM have no offset, so plz use OSM and contribute to it if you think OSM is not as good as Google map" that's totally wrong.

So please consider opening an interface for rewriting IITC native functions (for eg, L.Google) thus I can make my plugin more friendly to IITC and submit it to the public. Every Chinese player will like the plugin, this is a good thing :)

katpatuka commented 10 years ago

If you need coloring you can look at the map of http://demo.3liz.com/osmtransport/ showing transport features entered in OSM. Choose China and Shanghai...

Did you have a look at the transport layer of OSM for Shanghai ? (http://www.openstreetmap.org/#map=11/31.2398/121.4676&layers=T)

Do you use http://wikimapia.org in China? It's easy to compare maps by different providers there: Google, Bing, Yahoo, Ovi and OSM - enter Shanghai and compare on different zoomlevels...

Others sources:

breezewish commented 10 years ago

@katpatuka Sorry for my expressing, maybe there are some misunderstandings. You are right OSM do have public transport info but that's not in IITC. At least in IITC OSM I can't see them. Currently if I want to see public transports, I should switch between IITC and (Google/Baidu/OSM) Map. That is the same in mobile phones.

So do you have a better and simpler solution for finding portals and roads or public transports in one map? IITC default OSM map can not meet our needs (if you want a survey I can make one). I think adding an interface and providing plugins a 'legal' way to fix these offsets in Google map is the simplist. Indeed the offset is not the issue of IITC, but IITC should care about it.

ToeBee commented 10 years ago

For the record, neither katpatuka or myself are IITC devs and I am not saying this issue is bad or shouldn't be included in IITC. I just wanted to let you know that you had the option to improve the OSM map that you see in IITC. I've been known to add map data to OSM while waiting for Ingress portals to cool down :)

However if you want to display the transport layer in IITC, install the "OpenStreetMap.org map tiles" plugin and then edit line 44 to have the following tile URL:

var osm = new L.TileLayer('http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png', osmOpt);

And then use the layer switcher to switch to the OSM option.

ToeBee commented 10 years ago

Oh, never mind. The "OpenCycleMap.org map tiles" plugin already has the transport layer as an option. I live in an area with virtually no public transport so I have not explored this area before...

breezewish commented 10 years ago

@ToeBee Thank you for your advice! And, contributing to OSM at cool down time is really a good idea ;D

jonatkins commented 10 years ago

A few comments:

Firstly, I believe the issue is related to China not using the standard WGS-84 coordinate system for mapping, and (possibly) having some laws relating to this issue. This causes all sorts of accuracy issues when coordinates using one system are drawn onto a map using a different one.

I think the Google Maps use the Chinese coordinate system within China itself, but WGS84 for the rest of the world. This is nasty - and will lead to mismatches where the two different systems meet.

Can you confirm if these offset errors happen in Ingress itself, or on the standard intel map? If so, it's probably worth bringing the issue up with Niantic as a bug - perhaps they'll fix in some way?

Secondly, it is possible to use custom plugins on the mobile IITC app - Create a folder called IITC_Mobile on your storage, then a folder plugins within that. Copy the .user.js file to this folder. The plugins here will be listed within the settings and can then be enabled.

Before I consider integrating any plugins/changes into IITC I'd like to understand the problem better. If anyone has any references on how/why the Google Maps coordinates are 'wrong' it would be appreciated.

breezewish commented 10 years ago

@jonatkins Hello! Thank you for your reply :) I will try IITC mobile custom plugins.

Right, all formal map providers use GCJ-02 in China mainland. And the rest of map is WGS-84. (We called GCJ-02 the Mars Coordinate System). 3rd-party maps (eg, OSM) do not have such offsets (so to a certain extent they are illegal).

Google Map App is correct and I guess it has already applied offset to users' GPS location so it seems accurate on the map.

The official algorithm of GCJ-02 is secretive. However I found some folk code snippets and it seems accurate and useable.[1][2] I use this algorithm in the plugin (https://github.com/breeswish/iitc-plugin-googlemap-offset-fixer) and it works pretty well.

The official Ingress map (both ingress/intel and in the game) has offsets too. It has become a common knowledge that we cannot believe maps in ingress in China. I reported this issue and the reason to NIA (also did many other Chinese agents) and they replied Thanks for your report, agent. The NIA is aware of the problem with Chinese characters and GPS in China, and we are looking into these issues. The data you've provided will be utilized to improve Ingress Scanner technology. If additional information is needed, you will be contacted. but it seems that nothing happens :(