Fixed: Now name of points gets added to the GeoJSON properties.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.body.php
index 77d3f93e27c9fd3dc1d129f52ce3a6a863d18582..b6bd40b29b5c585b45b16f93057b484bbbe0dc6c 100644 (file)
@@ -61,8 +61,8 @@ function xml_to_json_features($input) {
                // point
                if (in_array($feature->getName(), array_keys($point_type))) {
                        $properties = array('type' => $point_type[$feature->getName()]);
                // point
                if (in_array($feature->getName(), array_keys($point_type))) {
                        $properties = array('type' => $point_type[$feature->getName()]);
-                       if (array_key_exists('wiki', $feature)) $properties['wiki'] = $feature['wiki'];
-                       if (array_key_exists('name', $feature)) $properties['name'] = $feature['name'];
+                       if (isset($feature['wiki'])) $properties['wiki'] = (string) $feature['wiki'];
+                       if (isset($feature['name'])) $properties['name'] = (string) $feature['name'];
                        $json_feature = array(
                                'type' => 'feature',
                                'geometry' => array(
                        $json_feature = array(
                                'type' => 'feature',
                                'geometry' => array(
@@ -76,8 +76,8 @@ function xml_to_json_features($input) {
                // line
                if (in_array($feature->getName(), array_keys($line_type))) {
                        $properties = array('type' => $line_type[$feature->getName()]);
                // line
                if (in_array($feature->getName(), array_keys($line_type))) {
                        $properties = array('type' => $line_type[$feature->getName()]);
-                       if (array_key_exists('farbe', $feature)) $properties['strokeColor'] = $feature['farbe'];
-                       if (array_key_exists('dicke', $feature)) $properties['strokeWidth'] = $feature['dicke'];
+                       if (isset($feature['farbe'])) $properties['strokeColor'] = (string) $feature['farbe'];
+                       if (isset($feature['dicke'])) $properties['strokeWidth'] = (string) $feature['dicke'];
                        $json_feature = array(
                                'type' => 'feature',
                                'geometry' => array(
                        $json_feature = array(
                                'type' => 'feature',
                                'geometry' => array(