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

add support for bing map url quadkey in ros1 branch #126

Open
wants to merge 3 commits into
base: ros1
Choose a base branch
from

Conversation

shupx
Copy link

@shupx shupx commented Sep 10, 2024

The bing map uses quadkey rather than tile xyz. The new commit adds support for the bing map quadkey in ros1 branch. For example, you can use the following bing satellite map url now:

http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1

, where {q} is the quadkey.

@Timple
Copy link
Member

Timple commented Sep 10, 2024

Cool!

Would you mind making the same change for ROS2?

@shupx
Copy link
Author

shupx commented Sep 11, 2024

Sorry. I am not familiar with ROS2 now.

Hope the ROS1 commit can be merged to the branch. haha

@Timple
Copy link
Member

Timple commented Sep 12, 2024

Alright, I'll do a review and forward port myself.

@@ -45,6 +45,11 @@ std::string tileURL(TileId const& tile_id)
boost::replace_all(url, "{x}", std::to_string(tile_id.coord.x));
boost::replace_all(url, "{y}", std::to_string(tile_id.coord.y));
boost::replace_all(url, "{z}", std::to_string(tile_id.zoom));

/* Added by Peixuan Shu to handle bing map */
boost::replace_all(url, "{q}", TilesToQuadkey(tile_id.coord.x,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes {q} from the url. Doesn't this break all other providers except bing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No influence on other map providers as there is no '{q}' in their urls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, good point.

Would you mind naming it {quadkey} in the url? Because {q} is often used for quaternion in the context of coordinate systems and ROS.

std::stringstream quadkey;
for (int i = z; i > 0; i--) {
char b = '0';
int mask = 1 << (i - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very magical function. Do you have a source for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how quadkey converted to tile xyz defined by Microsoft bing map team. Please refer to https://learn.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, would you mind adding that link in the function description for future reference?

src/tile_id.cpp Outdated Show resolved Hide resolved
src/tile_id.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Timple Timple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'm good!

Two minor things left. Thanks for you patience and cooperation!

@@ -45,6 +45,11 @@ std::string tileURL(TileId const& tile_id)
boost::replace_all(url, "{x}", std::to_string(tile_id.coord.x));
boost::replace_all(url, "{y}", std::to_string(tile_id.coord.y));
boost::replace_all(url, "{z}", std::to_string(tile_id.zoom));

/* Added by Peixuan Shu to handle bing map */
boost::replace_all(url, "{q}", TilesToQuadkey(tile_id.coord.x,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, good point.

Would you mind naming it {quadkey} in the url? Because {q} is often used for quaternion in the context of coordinate systems and ROS.

std::stringstream quadkey;
for (int i = z; i > 0; i--) {
char b = '0';
int mask = 1 << (i - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, would you mind adding that link in the function description for future reference?

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

Successfully merging this pull request may close these issues.

2 participants