Changeset 1a7f9da for src/mapservice
- Timestamp:
- Apr 4, 2020, 5:59:29 PM (7 years ago)
- Branches:
- debian/bullseye, master
- Children:
- 37f674d
- Parents:
- 7a831c3
- Location:
- src/mapservice
- Files:
-
- 2 edited
-
openapi.yaml (modified) (5 diffs)
-
src/server_impl/database/Model.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/mapservice/openapi.yaml
r7a831c3 r1a7f9da 820 820 - Feature 821 821 - Point 822 - LineString822 - FeatureCollection 823 823 geoJsonPoint: 824 824 type: object … … 831 831 coordinates: 832 832 $ref: '#/components/schemas/point' 833 geoJsonLineString:834 type: object835 description: GeoJson geometry836 externalDocs:837 url: 'http://geojson.org/geojson-spec.html#id3'838 properties:839 type:840 type: string841 coordinates:842 type: array843 items:844 $ref: '#/components/schemas/point'845 833 sensorDepth: 846 834 type: number … … 1138 1126 $ref: '#/components/schemas/LogMetaData' 1139 1127 LogGeoJson: 1140 title: Log in GeoJson format 1128 title: FeatureCollection representing a Log in GeoJson format 1129 type: object 1130 properties: 1131 type: 1132 $ref: '#/components/schemas/geoJsonType' 1133 features: 1134 type: array 1135 items: 1136 $ref: '#/components/schemas/LogEntryGeoJson' 1137 required: 1138 - type 1139 - features 1140 LogEntryGeoJson: 1141 title: Feature representing LogEntry in GeoJson format 1141 1142 type: object 1142 1143 properties: … … 1144 1145 $ref: '#/components/schemas/geoJsonType' 1145 1146 geometry: 1146 $ref: '#/components/schemas/geoJson LineString'1147 $ref: '#/components/schemas/geoJsonPoint' 1147 1148 properties: 1148 1149 type: object 1149 additionalProperties: 1150 type: object 1151 properties: 1152 name: 1153 type: string 1154 item: 1155 title: >- 1156 LogEntry as GeoJson property ordered in same order as geometry 1157 coordinates 1158 type: object 1159 properties: 1160 datetime: 1161 type: string 1162 format: date-time 1163 waterDepth: 1164 $ref: '#/components/schemas/itemName' 1165 comment: 1166 $ref: '#/components/schemas/comment' 1167 required: 1168 - datetime 1169 - waterDepth 1150 properties: 1151 datetime: 1152 type: string 1153 format: date-time 1154 waterDepth: 1155 type: number 1156 format: float 1157 required: 1158 - datetime 1170 1159 required: 1171 1160 - type … … 1384 1373 LogGeoJson: 1385 1374 value: 1386 type: Feature 1387 geometry: 1388 type: LineString 1389 coordinates: 1390 - - 90.136111 1391 - 29.934722 1392 - - 90.236111 1393 - 30.034722 1394 properties: 1395 prop0: 1375 type: FeatureCollection 1376 features: 1377 - geometry: 1378 coordinates: 1379 - 90.136111 1380 - 29.934722 1381 type: 'Point' 1382 properties: 1396 1383 datetime: 2017-07-21T10:32:28.000Z 1397 1384 waterDepth: 10 1398 prop1: 1385 - geometry: 1386 coordinates: 1387 - 90.236111 1388 - 30.034722 1389 type: Point 1390 properties: 1399 1391 datetime: 2017-07-21T11:32:28.000Z 1400 1392 waterDepth: 5 -
src/mapservice/src/server_impl/database/Model.py
r7a831c3 r1a7f9da 300 300 def to_geojson(obj): 301 301 result = { 302 'type': 'Feature', 303 'geometry': { 304 'type': 'LineString', 305 'coordinates': [] 306 }, 307 'properties': { } 302 'type': 'FeatureCollection', 303 'features': [] 308 304 } 309 305 if obj.log_entries: 310 prop = 0311 306 for log in obj.log_entries: 312 307 location = wkb_to_dict(log.location) 313 result['geometry']['coordinates'].append([location['longitude'], location['latitude']]) 314 result['properties']['prop{:09d}'.format(prop)] = { 315 'datetime': log.datetime.isoformat('T'), 316 'waterDepth': log.water_depth 308 feature = { 309 'type': 'Feature', 310 'geometry': { 311 'type': 'Point', 312 'coordinates': [location['longitude'], location['latitude']] 313 }, 314 'properties': { 315 'datetime': log.datetime.isoformat('T') 316 } 317 317 } 318 prop += 1 318 if log.water_depth is not None: 319 feature['properties']['waterDepth'] = log.water_depth 320 result['features'].append(feature) 319 321 return result 320 322
Note:
See TracChangeset
for help on using the changeset viewer.
