Changeset 1a7f9da for src/mapservice/src/server_impl/database/Model.py
- Timestamp:
- Apr 4, 2020, 5:59:29 PM (7 years ago)
- Branches:
- debian/bullseye, master
- Children:
- 37f674d
- Parents:
- 7a831c3
- File:
-
- 1 edited
-
src/mapservice/src/server_impl/database/Model.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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.
