fix handling of null-values for coordinates of Character groups Quest Stations

This commit is contained in:
oliver 2016-01-14 19:19:12 +01:00
commit 33e1c4d8b5
2 changed files with 19 additions and 34 deletions

View file

@ -6,22 +6,24 @@
// Add points // Add points
foreach($stations as &$station) foreach($stations as &$station)
{ {
$coordinate = array( if(!is_null($station['longitude']) && !is_null($station['latitude'])) {
floatval($station['longitude']), $coordinate = array(
floatval($station['latitude']) floatval($station['longitude']),
); floatval($station['latitude'])
$coordinates[] = $coordinate; );
$features[] = array( $coordinates[] = $coordinate;
'type' => 'Feature', $features[] = array(
'id' => $station['id'], 'type' => 'Feature',
'properties' => array( 'id' => $station['id'],
'name' => $station['title'], 'properties' => array(
), 'name' => $station['title'],
'geometry' => array( ),
'type' => 'Point', 'geometry' => array(
'coordinates' => $coordinate 'type' => 'Point',
) 'coordinates' => $coordinate
); )
);
}
} }
// Add lines between points // Add lines between points

View file

@ -194,28 +194,11 @@
new ol.layer.Vector({ new ol.layer.Vector({
source: markersSource, source: markersSource,
style: styleFunction style: styleFunction
/*
style: new ol.style.Style({
text: new ol.style.Text({
text: '\uf041',
//text: '\uf276',
font: 'normal 28px FontAwesome',
textBaseline: 'Bottom',
fill: new ol.style.Fill({
color: '#0F373C'
})
})
})
*/
})/*,
new ol.layer.Vector({
source: pathSource
}) })
*/
], ],
target: 'map', target: 'map',
view: new ol.View({ view: new ol.View({
center: ol.proj.transform([<?=$station['longitude']?>, <?=$station['latitude']?>], 'EPSG:4326', 'EPSG:3857'), center: [0, 0],
zoom: 19, zoom: 19,
maxZoom: 19 maxZoom: 19
}) })