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

Main city in Norway without result. #7

Open
ariselseng opened this issue Jan 6, 2018 · 6 comments
Open

Main city in Norway without result. #7

ariselseng opened this issue Jan 6, 2018 · 6 comments

Comments

@ariselseng
Copy link

\DaveRoss\OfflineCountryReverseGeocoder\get_country(5.7324723,58.9696274)
This is in the center of one of the major cities in Norway, without any result.

@RobinvanderVliet
Copy link

The first argument is the longitude and the second argument is the latitude. You switched them.

@ariselseng
Copy link
Author

Oh that is just in the example. Sorry. Some places near the coast are still not detected.

@RobinvanderVliet
Copy link

Maybe this happens happens because of limited precision in the polygon file? That seems to me like a logical explanation.

@ariselseng
Copy link
Author

ariselseng commented Apr 2, 2018

@RobinvanderVliet You are probably right yes.
If you get coordinates near a country border you will get the same result as me. It would be nice if we could have a "get_nearest_country()" or something. If the coordinates are like 200meters out in the sea, the actual country that owns that area should be the result.

Right now I have fallback code to do a online lookup if the result is empty. Works okay, but I would love to have a 100% offline solution.

@RobinvanderVliet
Copy link

I just tried it with a location in the Netherlands very close to the German border, and I received "DE" as a result.

@ariselseng
Copy link
Author

Try this:
Only the last one works.

//around Stavanger, Norway
var_dump(\DaveRoss\OfflineCountryReverseGeocoder\get_country(5.641784, 59.037492));
var_dump(\DaveRoss\OfflineCountryReverseGeocoder\get_country(5.739792, 58.971404));

//in Sweden, near the border with Norway
var_dump(\DaveRoss\OfflineCountryReverseGeocoder\get_country(11.262722, 59.095614));
var_dump(\DaveRoss\OfflineCountryReverseGeocoder\get_country(11.265855, 59.093015));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants