Browse Source

Some GeoJSON fixes

Maurits van der Schee 6 years ago
parent
commit
30403e4619

+ 1
- 3
src/Tqdev/PhpCrudApi/GeoJson/GeoJsonService.php View File

@@ -59,9 +59,7 @@ class GeoJsonService
59 59
 
60 60
         $features = array();
61 61
         foreach ($records->getRecords() as $record) {
62
-            if (isset($record[$geometryColumnName])) {
63
-                $features[] = $this->convertRecordToFeature($record, $geometryColumnName);
64
-            }
62
+            $features[] = $this->convertRecordToFeature($record, $geometryColumnName);
65 63
         }
66 64
         return new FeatureCollection($features);
67 65
     }

tests/functional/001_records/083_list_countries_as_geojson.log → tests/functional/001_records/083_list_users_as_geojson.log View File

@@ -2,6 +2,6 @@ GET /geojson/users
2 2
 ===
3 3
 200
4 4
 Content-Type: application/json
5
-Content-Length: 174
5
+Content-Length: 269
6 6
 
7
-{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":1,"username":"user1","password":"testtest2"},"geometry":{"type":"Point","coordinates":[30,20]}}]}
7
+{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"id":1,"username":"user1","password":"testtest2"},"geometry":{"type":"Point","coordinates":[30,20]}},{"type":"Feature","properties":{"id":2,"username":"user2","password":"pass2"},"geometry":null}]}

Loading…
Cancel
Save