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

Map and list of regions do not show same results #20368

Closed
pbb72 opened this issue Feb 16, 2023 · 6 comments
Closed

Map and list of regions do not show same results #20368

pbb72 opened this issue Feb 16, 2023 · 6 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@pbb72
Copy link

pbb72 commented Feb 16, 2023

image
The regions that are colored on the map, do not correspond to the regions in the list. The map in this screenshot shows 12.332 visitors for Oslo (which is expected), but in the list this number is assigned to Hordaland. On the map, Rogaland and Møre og Rømsdal show 9.688 and 2.356 visitors, in the list these are Sogn og Fjordane and Telemark. The list shows 2.638 visitors from Aust-Agder, this number doesn't show up on the map at all.

To be honest, I am actually suspicious about if these numbers are correct at all; many thousands of visitors from 3 or 4 regions, and none at all from the other regions.

Also, the legend shows 1 dark blue and 2 light blue values, while the map shows 2 dark blue and 1 light blue region. The light blue values in the legend are also indistinguishable by eye and thus there is no use to list these.

Expected Behavior

Values on the list of regions and the map should correspond.

Current Behavior

Values on the list of regions and the map do not correspond. It looks like the list of regions is actually faulty.

Possible Solution

Fix it. 😉

Steps to Reproduce (for Bugs)

  1. Visit the "Locations" page of Matomo. Zoom in to Norway.
  2. Compare the regions on the map with the list of regions besides.

Context

Your Environment

  • Matomo Version: 4.13.1
  • PHP Version: 8.1.14
  • Server Operating System: Apache/2.4.54 (Debian)
  • Additionally installed plugins:
  • Browser:
  • Operating System:
@pbb72 pbb72 added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Feb 16, 2023
@bx80
Copy link
Contributor

bx80 commented Feb 17, 2023

Thanks for spotting this @pbb72, it looks like at least the names of the regions on the map and on the list are not consistent. The legend looks wrong too.

Geo location isn't always very accurate and often rural regions have IP addresses that resolve to the nearest urban center (e.g. my own IP address doesn't map to my rural region and instead maps to a city 300km away), it's possible that some of the provinces are being allocated to nearby cities. It often depends on the quality of the GeoIP database being used.

I'll assign this issue for prioritization 👍

@bx80 bx80 added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Feb 17, 2023
@bx80 bx80 added this to the For Prioritization milestone Feb 17, 2023
@sgiehl
Copy link
Member

sgiehl commented Feb 17, 2023

This one is actually quite easy to explain. Our map is very very outdated. And therefor it contains some regions, that have meanwhile be restructured/renamed. In addition the region names on the map, are hard coded in the SVGs.
The regions in the report are those returned by the geoip provider. Internally we store such regions as region codes only. For displaying them in the reports they are replaced with their names using this mapping file: https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/GeoIp2/data/isoRegionNames.php#L3722
This file might also be a bit outdated meanwhile.
I don't think there is much we can do at the moment besides waiting for #11929

@pbb72
Copy link
Author

pbb72 commented Feb 17, 2023

Okay so the problem is actually two; both the map components is outdated, but the GeoIP2 list of regions is also outdated. Compare https://github.com/matomo-org/matomo/blob/4.x-dev/plugins/GeoIp2/data/isoRegionNames.php#L3722 to https://en.wikipedia.org/wiki/Counties_of_Norway#List_of_counties; only 5 of the regions in your list still exist. This could explain why there is so high number of unknown regions for Norway.

However, it doesn't explain why Trøndelag, region nr 50, which is on you GeoIP2 list and is still current, is not listed at all while it should have a reasonable number. (I am actually located in Trøndelag.)

(As a general rule, geographic information needs to be updated at least once a year. If this is not possible, it's better to display the raw data (either coordinates, region numbers or uninterpreted names) that to try and interpret them.)

@sgiehl
Copy link
Member

sgiehl commented Feb 20, 2023

@pbb72 I agree that we should updates some of the data we are using. But it might be some more effort as simply updating the list. We also might need to keep the data for revised regions, as otherwise Matomo would later not be able to display already archived data.

@mattab We should consider working on this one soon. It might affect a lot people and the data displayed in Matomo might look inaccurate, even though it's tracked correctly. I guess I could adjust the region handling and the update script in around 3 hours to be more accurate. This adjustment might also help in other terms, where regions are not detected correctly using dbip databases.

@sgiehl sgiehl added the Needs priority decision This issue may need to be added to the current milestone by Product Manager label Feb 20, 2023
@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Mar 12, 2023
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/geolocation-real-time-map/49564/2

@sgiehl sgiehl removed the Needs priority decision This issue may need to be added to the current milestone by Product Manager label May 12, 2023
@sgiehl
Copy link
Member

sgiehl commented Jun 20, 2023

I'll close this one for now. It should be improved / fixed with #20420
If anyone still has such problems after upgrading to Matomo 5, feel free to create a new issue for it.

@sgiehl sgiehl closed this as completed Jun 20, 2023
@sgiehl sgiehl added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jun 20, 2023
@sgiehl sgiehl modified the milestones: Impact Backlog, 5.0.0 Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

5 participants