Skip to content

Commit b95445f

Browse files
authored
Merge pull request #90 from joubu/issue_89
Fix #89: Do not generate the geojson data for each request
2 parents 7f3605f + bd29820 commit b95445f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

include/functions_map.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,13 @@ function osm_get_js($conf, $local_conf, $js_data)
523523
\t}";
524524
if (isset($local_conf['paths'])) {
525525
foreach ($local_conf['paths'] as $path) {
526-
$ext = pathinfo($path);
527-
$ext = $ext['extension'];
528-
$js .= "\nomnivore.".$ext."('".$path."').addTo(".$divname.");";
526+
$ext = pathinfo($path)['extension'];
527+
$geojson_path = str_replace(".$ext", '.geojson', $path);
528+
if (file_exists($geojson_path) and is_readable ($geojson_path)){
529+
$js .= "\nomnivore.geojson('".$geojson_path."').addTo(".$divname.");";
530+
} else {
531+
$js .= "\nomnivore.".$ext."('".$path."').addTo(".$divname.");";
532+
}
529533
}
530534
}
531535
$js .= "\nif (typeof L.MarkerClusterGroup === 'function')\n";

0 commit comments

Comments
 (0)