bradfitz / latlong

The latlong package maps from a latitude and longitude to a timezone.
Apache License 2.0
384 stars 41 forks source link

Denmark coords resolve as Asia/Phnom_Penh #1

Open cicika opened 9 years ago

cicika commented 9 years ago

Hi!

There's a patch of Denmark that resolves into Asia/Phnom_Penh timezone, which is quite unusual. I would have addressed the problem myself, but, admittedly, I have been playing with the language only for a short while, and wouldn't even know where to start.

Example coords: 55.850667, 12.56804

Awesome lib by the way and a wonderful solution to the problem.

Thanks!

porjo commented 9 years ago

I have confirmed this using latest tz_world data. Using this code, I found the bounding box of this anomaly to be:

http://bbox.me/osm/index.html?bbox=55.812497,12.562490,56.000007,12.750010

I've opened the tz_world shapefile in Qgis and AFAIK it looks OK. Selecting 'Asia/Phnom_Penh' and zooming in on that does not include any area near Denmark.

bradfitz commented 9 years ago

Sorry, I can't look at this anytime soon. I'm offline for two weeks starting tomorrow, on vacation. Let me know if you discover any other clues.

porjo commented 9 years ago

I notice that the tests are failing and timezone Asia/Phnom_Penh appears in the output. Coincidence?

Sorry, ignore that. Tests were failing due to non-existence of tables. Tests are OK :blush:

latlong_test.go contains this comment alluding to a previous bug involving Asia/Phnom_Penh

                // previous bug with the wrong oceanIndex. This pixmap
                // leaf resolves to leaf index 0xff (Asia/Phnom_Penh).
                // It was being treated as a special value. It's not.
cicika commented 9 years ago

Singapore airport also resolves to Asia/Phnom_Penh... If I ever get the time I might make a pull request.

sidazhang commented 8 years ago

@bradfitz I know that this library isn't supposed to be very accurate and you probably don't have time to mantain this.

Would you have recommendations for a more accurate go library to use?

bradfitz commented 7 years ago

Not off the top of my head.

bradfitz commented 7 years ago

@cicika, @sidazhang, could either of you try this again with the latest data?

porjo commented 7 years ago

I tested this earlier and thought it looked good, but turns out that the coords @cicika supplied now return no timezone! e.g.

        lat := 55.850667
    lon := 12.56804
    fmt.Println(latlong.LookupZoneName(lat, lon))

returns blank. I've tried a few other locations around the globe and they return correct results.

alex-fung commented 6 years ago

I still get the above result – blank zone names for certain lat, lng's, looks like it's usually when it's close to the water.

vsile commented 5 years ago

For Singapore I also get blank zone names

lat := 1.294719
long := 103.774107
fmt.Println(latlong.LookupZoneName(lat, long))

How to fix it?