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 sub-region tile servers (local maps) #128

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

cgeller
Copy link

@cgeller cgeller commented Nov 13, 2024

New Feature: Support for Sub-Region Tile Servers

This pull request introduces a new feature allowing support for tile servers that provide maps for a specific sub-region rather than global coverage. This functionality is enabled via a new top-level property: Use Local Map.

Details

For tile servers covering only a specific sub-region, zoom levels and tile coverage may deviate from typical global tile maps. Thus, certain properties need to be configured manually. Specifically:

  • Local Origin: The top-left corner of the local map region.
  • Pixel Size at Zoom Level 0: Defines the scale of the map.

Refer to OpenStreetMap's guide on zoom levels for more context on how zoom levels affect tile size and coverage.

New Properties under Use Local Map

The following properties are introduced to support configuration for local map servers:

  • Meter per Pixel (Zoom 0): Defines the length (in meters) of a pixel edge at zoom level 0. Default is 0.0.
  • Origin CRS: The EPSG code for the coordinate reference system (CRS) of the local origin. This should be a cartesian coordinate system. Default is not set.
  • Origin X: The X-coordinate of the local origin in the specified CRS. Default is 0.0.
  • Origin Y: The Y-coordinate of the local origin in the specified CRS. Default is 0.0.

Additional Notes

Please review the "Example Usage" section in the README.md for detailed usage examples and to verify integration with existing functionality.

std::string origin_crs;

// local map projection
PJ_CONTEXT * context = proj_context_create();
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this PR!

Would you mind using smart pointers here?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your feedback on this pull request.

You could use smart pointers (potentially std::unique_ptr ), but objects of type TileMapInformation are passed into different functions. Thus, an explicit copy constructor would have to be defined for TileMapInformation. In addition, you would probably also define a custom destructor that calls special "cleanup" functions of the PROJ Lib.

Since the use of smart pointers has been largely avoided in the repository, I have not used them as well. But of course, we can discuss this again. What do you think?

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