Here are the examples of the python api sqlalchemy.func.ST_AsGeoJSON taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : cli.py
Copyright GNU General Public License v3.0
Author : EdwardBetts
Copyright GNU General Public License v3.0
Author : EdwardBetts
@app.cli.command()
@click.argument('place_identifier')
def polygons(place_identifier):
place = get_place(place_identifier)
chunk_size = utils.calc_chunk_size(place.area_in_sq_km)
place_geojson = (database.session.query(func.ST_AsGeoJSON(Place.geom, 4))
.filter(Place.place_id == place.place_id)
.scalar())
# print(place_geojson)
for chunk in place.chunk_n(chunk_size):
print(', '.join('{:.3f}'.format(i) for i in chunk))
(ymin, ymax, xmin, xmax) = chunk
clip = func.ST_Intersection(Place.geom,
func.ST_MakeEnvelope(xmin, ymin, xmax, ymax))
chunk_geojson = (database.session
.query(func.ST_AsGeoJSON(clip, 4))
.filter(Place.place_id == place.place_id)
.scalar())
print(chunk_geojson)