-
Notifications
You must be signed in to change notification settings - Fork 97
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
Feature: Custom osm URL and attribution #435
base: master
Are you sure you want to change the base?
Conversation
$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'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
$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', | ||
), | ||
) | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
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.