Bladeren bron

Some GeoJSON fixes

Maurits van der Schee 6 jaren geleden
bovenliggende
commit
d03449f087

+ 2
- 0
src/Tqdev/PhpCrudApi/GeoJson/GeoJsonService.php Bestand weergeven

@@ -55,6 +55,7 @@ class GeoJsonService
55 55
     {
56 56
         $geometryParam = isset($params['geometry']) ? $params['geometry'][0] : '';
57 57
         $geometryColumnName = $this->getGeometryColumnName($tableName, $geometryParam);
58
+        $params['mandatory'][] = $tableName . "." . $geometryColumnName;
58 59
         $records = $this->records->_list($tableName, $params);
59 60
 
60 61
         $features = array();
@@ -68,6 +69,7 @@ class GeoJsonService
68 69
     {
69 70
         $geometryParam = isset($params['geometry']) ? $params['geometry'][0] : '';
70 71
         $geometryColumnName = $this->getGeometryColumnName($tableName, $geometryParam);
72
+        $params['mandatory'][] = $tableName . "." . $geometryColumnName;
71 73
         $record = $this->records->read($tableName, $id, $params);
72 74
         return $this->convertRecordToFeature($record, $geometryColumnName);
73 75
     }

+ 3
- 3
tests/functional/001_records/083_list_users_as_geojson.log Bestand weergeven

@@ -6,13 +6,13 @@ Content-Length: 269
6 6
 
7 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}]}
8 8
 ===
9
-GET /geojson/users?geometry=location
9
+GET /geojson/users?geometry=location&include=username
10 10
 ===
11 11
 200
12 12
 Content-Type: application/json
13
-Content-Length: 269
13
+Content-Length: 213
14 14
 
15
-{"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}]}
15
+{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"username":"user1"},"geometry":{"type":"Point","coordinates":[30,20]}},{"type":"Feature","properties":{"username":"user2"},"geometry":null}]}
16 16
 ===
17 17
 GET /geojson/users?geometry=notlocation
18 18
 ===

Loading…
Annuleren
Opslaan