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

Feature: Custom osm URL and attribution #435

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

Conversation

e1mo
Copy link

@e1mo e1mo commented Nov 7, 2022

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.

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 &copy; <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 &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community';
}
Copy link
Author

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.

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 &amp;copy; &lt;a href=&quot;https://www.openstreetmap.org/&quot;&gt;OpenStreetMap&lt;/a&gt; contributors',
'css' => 'width:100%;',
'type' => 'text',
'desc' => esc_attr__('Leave empty to use the default', 'sportspress'),
),
array(
'type' => 'sectionend',
'id' => 'general_options',
),
)
);

Copy link
Author

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!

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.

1 participant