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

Maps.Me coordinates encode #2

Closed
ghost opened this issue Jan 31, 2020 · 5 comments
Closed

Maps.Me coordinates encode #2

ghost opened this issue Jan 31, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 31, 2020

Hello! I'm Michael.

I'm searching for a way to encode coordinates in Maps.Me format to create custom links. And there's no information about from Maps.Me at all.
Could you help with that? I checked your decode ge0 URL code and hope you could help me with it.

Thanks a lot!

@mpimenov
Copy link

mpimenov commented Feb 3, 2020

Hello.
Please see mapsme/omim#6386.
The current version of the core ge0 routines is here: https://github.com/mapsme/omim/tree/aab28bc72ec3baf1ffb7588dd93375cb6604fcba/ge0

@ghost
Copy link
Author

ghost commented Feb 10, 2020

@mpimenov, Thanks a lot!

But why the accuracy of longitude is so low? It always truncates it.
How can I solve this?
I give to function latitude: 50.2662864 and longitude: 28.6859482. But throw decoder I take:
latitude: 50.26629,
longitude: 28.0,

@mpimenov
Copy link

The output of this test, added to https://github.com/mapsme/omim/blob/a1a15b4c4d8b922ee69588bf99c8650b319ab5b9/ge0/ge0_tests/parser_tests.cpp

UNIT_TEST(ge0_url_decoder_issue_2)
{
  string const url = GenerateShortShowMapUrl(50.2662864, 28.6859482, 19, "");

  Ge0Parser parser;
  double parsedLat;
  double parsedLon;
  string parsedName;
  double parsedZoomLevel;
  bool const result = parser.Parse(url.c_str(), parsedLat, parsedLon, parsedName, parsedZoomLevel);

  LOG(LINFO, (parsedLat));
  LOG(LINFO, (parsedLon));
}

is

$ ./ge0_tests --filter=issue
Running parser_tests.cpp::ge0_url_decoder_issue_2
50.2663
28.6859
OK
Test took 0 ms

All tests passed.

What you see looks like a type error somewhere (longitude seems to be converted to integer), probably you are using a wrong implementation.

Our library at https://github.com/mapsme/omim/tree/a1a15b4c4d8b922ee69588bf99c8650b319ab5b9/ge0 works correctly in your case as shown by the test above. This is the only implementation that is supported by us.
The repository where our discussion takes place (https://github.com/mapsme/ge0_url_decoder) is obsolete and not supported.

@mpimenov
Copy link

mpimenov commented Feb 10, 2020

Your coordinates encoded by our library at zoom 19 result in the "ge0://84To-til2K" string.
Here they are properly decoded: https://maps.me/ge0?latlonzoom=84To-til2K

@ghost
Copy link
Author

ghost commented Feb 10, 2020

Thank you!
I used wrong function on the delimiter. Now everything works!

@ghost ghost closed this as completed Feb 10, 2020
This issue was closed.
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

1 participant