Feature: Custom osm URL and attribution#435
Open
e1mo wants to merge 3 commits intoThemeBoy:masterfrom
Open
Conversation
e1mo
commented
Nov 7, 2022
Comment on lines
+75
to
+85
| $maptype = get_option( 'sportspress_map_type', 'roadmap' ); | ||
| $maptype = strtolower( $maptype ); | ||
| $osm_tile = get_option( 'sportspress_osm_tile_server', '' ); | ||
| $osm_tile = strtolower( $osm_tile ); | ||
| $osm_tile = empty( $osm_tile ) ? 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' : $osm_tile; | ||
| $osm_attribution = get_option( 'sportspress_osm_attribution', '' ); | ||
| $osm_attribution = empty( $osm_attribution ) ? 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors' : $osm_attribution; | ||
| if ( 'satellite' === $maptype ) { | ||
| $osm_tile = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'; | ||
| $osm_attribution = 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'; | ||
| } |
Author
There was a problem hiding this comment.
Deduplicating this and themes/venue-map.php would probably be a good idea. Tho I'm not sure how this could be done in the most elegant fashion.
e1mo
commented
Nov 7, 2022
Comment on lines
+250
to
+285
| $options = array_merge( | ||
| $options, | ||
| array( | ||
| array( | ||
| 'type' => 'sectionend', | ||
| 'id' => 'general_options', | ||
| ), | ||
| array( | ||
| 'title' => esc_attr__( 'OpenStreetMap', 'sportspress' ), | ||
| 'type' => 'title', | ||
| 'desc' => '', | ||
| 'id' => 'osm_options', | ||
| ), | ||
| array( | ||
| 'title' => esc_attr__( 'Tile server', 'sportspress' ), | ||
| 'id' => 'sportspress_osm_tile_server', | ||
| 'placeholder' => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
| 'css' => 'width:100%;', | ||
| 'type' => 'text', | ||
| 'desc' => esc_attr__('Leave empty to use the default', 'sportspress'), | ||
| ), | ||
| array( | ||
| 'title' => esc_attr__( 'Attributions', 'sportspress' ), | ||
| 'id' => 'sportspress_osm_attribution', | ||
| 'placeholder' => 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors', | ||
| 'css' => 'width:100%;', | ||
| 'type' => 'text', | ||
| 'desc' => esc_attr__('Leave empty to use the default', 'sportspress'), | ||
| ), | ||
| array( | ||
| 'type' => 'sectionend', | ||
| 'id' => 'general_options', | ||
| ), | ||
| ) | ||
| ); | ||
|
|
Author
There was a problem hiding this comment.
Two minutes after posting I stumbled across the map settings on the event page which I totally missed. I think those should be moved there, but I'm not sure (I'm neither familiar with wp plugins nor this codebase) how these settings could be incorporated. Maybe something like the other option sportspress_event_teams_delimiter could work here?
I'm very open to ideas, patches or hints how this could be implemented!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regarding privacy legislation in Europe (GDPR) using a custom OSM tile server may be desirable for some website operators. Privacy however, is not the only reason to use a custom tile server. Some users may simply be interested in a different looking map which can also be achieved using this setting.