You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The existing country lookup in OpenStreetMapAPI should not be extended for this feature. Reverse geocoding / country lookup functionality is currently being moved into the new [Alps-Lib Geo module](AlpsBTE/Alps-Lib#17).
Address-specific Photon functionality may be implemented locally inside BTT for now. If the required functionality is available through Alps-Lib by the time this is implemented, it should be reused where appropriate instead of duplicating it.
Forward geocoding (address -> coordinates) is currently not part of the Alps-Lib implementation and can therefore be implemented in BTT.
The implementation may be split into multiple PRs if useful, for example separating the general Photon/address implementation from the individual subcommands.
The exact internal structure and parsing may change in the future.
A: Get current address — /address get
/address get
Resolve the player's current Minecraft position to geographical coordinates and perform a reverse-geocoding lookup to retrieve the closest available address/location.
The required conversion from Minecraft coordinates to geographical coordinates already exists in the projection library.
Convert the Minecraft coordinates to geographical latitude/longitude.
Reverse geocode the coordinates.
Display the closest available human-readable address/location to the player.
The displayed address should preferably be clickable so that the player can copy it.
Additional information returned by Photon, such as city, state/region or country, may also be displayed, but this is not required for the initial implementation.
Reverse-geocoding accuracy
This needs to be tested with Photon.
Depending on the location and available OpenStreetMap data, Photon may not always return a complete address containing a street and house number. The command should therefore gracefully display the best available location information instead of assuming that every response contains all address fields.
For example, depending on the result, the output might contain:
Hauptplatz 1, 4020 Linz, Austria
or only something less specific such as:
Hauptplatz, Linz, Austria
Optional: Console support
Optionally allow the command to be executed from console by explicitly supplying coordinates:
/address get <latitude> <longitude>
Example:
/address get 48.3059 14.2862
When executed by a player without coordinates, the player's current location should be used.
B: Teleport to an address — /address teleport
/address teleport <address...>
Search for an address using Photon and teleport the player to the resulting geographical location.
Everything after the teleport subcommand should be treated as the address query.
It is not necessary to manually parse the input into street, house number, postcode, city, etc. The query should instead be joined into a single string and properly URL encoded before being sent to Photon.
For example:
/address teleport Hauptplatz 1, 4020 Linz
should result in a Photon query equivalent to:
q=Hauptplatz 1, 4020 Linz
Search results
For the initial implementation, the highest-ranked Photon result can be used.
A successful lookup should give the player feedback showing which location/address was resolved before or while teleporting.
For example:
Address found: Hauptplatz 1, 4020 Linz, Austria
Teleporting...
Supporting multiple search results or allowing players to select between multiple candidates can be added later and is not required for the initial implementation.
Teleportation
Photon returns GeoJSON coordinates in the order:
[longitude, latitude]
BTT/TPLL uses:
latitude longitude
Make sure these are converted into the correct order.
After resolving the address, teleportation should use the existing /tpll workflow instead of implementing separate geographical teleportation logic.
Equivalent command:
/tpll <latitude> <longitude>
This is important because BTT's existing TPLL handling also takes care of navigation between BuildTeams/servers where required.
Error handling
Both subcommands should provide useful feedback instead of failing silently.
At minimum, handle:
No address/query supplied to /address teleport
No Photon search result found
No useful reverse-geocoding result found
Photon/API request failure
Invalid or malformed API response
Invalid coordinates when using console /address get
Command being used from console where a player is required
External HTTP requests must not block the Minecraft server thread.
Command handling
The command should be registered through the Navigation module.
At minimum, tab completion should support:
/address get
/address teleport
Running:
/address
or an unknown subcommand should display the command usage/help.
Appropriate permissions should also be added. This can either use one permission for the complete command or separate permissions for the two actions.
For example:
btt.address.use
or:
btt.address.get
btt.address.teleport
The exact permission structure can follow the conventions used by the other Navigation commands.
Acceptance criteria
/address get resolves the player's current geographical location to the closest available address/location.
The returned address can preferably be copied by clicking it.
/address teleport <address...> resolves a free-form address using Photon.
The resolved geographical coordinates are passed through the existing TPLL workflow.
Photon [longitude, latitude] coordinates are converted correctly.
Empty results and API errors produce useful player feedback.
External API requests do not block the server thread.
The command is registered as part of the Navigation module.
get and teleport are available through tab completion.
The implementation does not add new address functionality to the legacy BTT country-lookup implementation that is being moved to Alps-Lib.
Add a new
/addresscommand for resolving the real-world address of the player's current location and teleporting to a location by address.Command style:
The command should be part of the Navigation module.
For geocoding, use the [Photon API](https://photon.komoot.io/).
Note
The existing country lookup in
OpenStreetMapAPIshould not be extended for this feature. Reverse geocoding / country lookup functionality is currently being moved into the new [Alps-Lib Geo module](AlpsBTE/Alps-Lib#17).Address-specific Photon functionality may be implemented locally inside BTT for now. If the required functionality is available through Alps-Lib by the time this is implemented, it should be reused where appropriate instead of duplicating it.
Forward geocoding (
address -> coordinates) is currently not part of the Alps-Lib implementation and can therefore be implemented in BTT.The implementation may be split into multiple PRs if useful, for example separating the general Photon/address implementation from the individual subcommands.
The exact internal structure and parsing may change in the future.
A: Get current address —
/address getResolve the player's current Minecraft position to geographical coordinates and perform a reverse-geocoding lookup to retrieve the closest available address/location.
The required conversion from Minecraft coordinates to geographical coordinates already exists in the projection library.
As a reference, see the old [BTE-tools address command](https://github.com/SteelAlloy/BTE-tools/blob/master/src/address.js).
Behaviour
The displayed address should preferably be clickable so that the player can copy it.
Additional information returned by Photon, such as city, state/region or country, may also be displayed, but this is not required for the initial implementation.
Reverse-geocoding accuracy
This needs to be tested with Photon.
Depending on the location and available OpenStreetMap data, Photon may not always return a complete address containing a street and house number. The command should therefore gracefully display the best available location information instead of assuming that every response contains all address fields.
For example, depending on the result, the output might contain:
or only something less specific such as:
Optional: Console support
Optionally allow the command to be executed from console by explicitly supplying coordinates:
Example:
When executed by a player without coordinates, the player's current location should be used.
B: Teleport to an address —
/address teleportSearch for an address using Photon and teleport the player to the resulting geographical location.
Example:
Example Photon requests:
Minimal example:
Address parsing
Everything after the
teleportsubcommand should be treated as the address query.It is not necessary to manually parse the input into street, house number, postcode, city, etc. The query should instead be joined into a single string and properly URL encoded before being sent to Photon.
For example:
should result in a Photon query equivalent to:
Search results
For the initial implementation, the highest-ranked Photon result can be used.
A successful lookup should give the player feedback showing which location/address was resolved before or while teleporting.
For example:
Supporting multiple search results or allowing players to select between multiple candidates can be added later and is not required for the initial implementation.
Teleportation
Photon returns GeoJSON coordinates in the order:
BTT/TPLL uses:
Make sure these are converted into the correct order.
After resolving the address, teleportation should use the existing
/tpllworkflow instead of implementing separate geographical teleportation logic.Equivalent command:
This is important because BTT's existing TPLL handling also takes care of navigation between BuildTeams/servers where required.
Error handling
Both subcommands should provide useful feedback instead of failing silently.
At minimum, handle:
/address teleport/address getExternal HTTP requests must not block the Minecraft server thread.
Command handling
The command should be registered through the Navigation module.
At minimum, tab completion should support:
Running:
or an unknown subcommand should display the command usage/help.
Appropriate permissions should also be added. This can either use one permission for the complete command or separate permissions for the two actions.
For example:
or:
The exact permission structure can follow the conventions used by the other Navigation commands.
Acceptance criteria
/address getresolves the player's current geographical location to the closest available address/location./address teleport <address...>resolves a free-form address using Photon.[longitude, latitude]coordinates are converted correctly.getandteleportare available through tab completion.