Implement a file layer for gpx,kml,wkt support.

This commit is contained in:
David Molineus
2017-10-17 16:50:29 +02:00
parent 31a5cc40a5
commit d1f26056e9
9 changed files with 170 additions and 1 deletions

View File

@@ -45,6 +45,10 @@ parameters:
extend: true
fit: true
file:
children: false
icon: 'bundles/netzmachtcontaoleaflet/img/file.png'
services:
_defaults:
public: false

View File

@@ -58,6 +58,10 @@ services:
tags:
- { name: netzmacht.contao_leflet_maps.mapper }
netzmacht.contao_leaflet.mapper.file_layer:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
tags:
- { name: netzmacht.contao_leaflet.mapper }
# Control mappers
netzmacht.contao_leaflet.mapper.zoom_control:

View File

@@ -217,6 +217,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'pointToLayer',
],
],
'file extends default' => [
'+config' => ['file'],
'+expert' => [
'onEachFeature',
'pointToLayer',
],
],
],
'metasubselectpalettes' => [
@@ -853,5 +861,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
],
'sql' => 'mediumtext NULL',
],
'file' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'],
'exclude' => true,
'inputType' => 'fileTree',
'eval' => [
'filesOnly' => true,
'fieldType' => 'radio',
'mandatory' => true,
'extensions' => 'gpx,kml,wkt',
'tl_class' => 'clr',
],
'sql' => 'binary(16) NULL',
],
],
];

View File

@@ -39,6 +39,8 @@ $GLOBALS['TL_LANG']['leaflet_layer']['tile'][0] = 'Tile layer';
$GLOBALS['TL_LANG']['leaflet_layer']['tile'][1] = 'Tile layer with full config options.';
$GLOBALS['TL_LANG']['leaflet_layer']['overpass'][0] = 'Overpass API';
$GLOBALS['TL_LANG']['leaflet_layer']['overpass'][1] = 'Overpass API data layer.';
$GLOBALS['TL_LANG']['leaflet_layer']['file'][0] = 'File';
$GLOBALS['TL_LANG']['leaflet_layer']['file'][1] = 'Geo data from a file (gpx,kml,wkt).';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][0] = 'Polyline';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][1] = 'Polyline overlay. For more details read the <a href="http://leafletjs.com/reference.html#polyline" target="_blank">Leaflet documentation</a>.';

View File

@@ -145,6 +145,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['amenity'][0] = 'Amen
$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenity'][1] = 'OSM amenity.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcon'][1] = 'Icon';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcon'][0] = 'Icon style';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][0] = 'File';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][1] = 'Choose a file containing geodata. Supported formats are gpx,kml and wkt.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][0] = 'Layer group';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic layer group. <br> See <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">http://leafletjs.com/reference.html#layergroup</a>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B