本文介紹 django.contrib.gis.db.models.functions.AsGeoJSON
的用法。
聲明
class AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra)
Availability
: MariaDB (≥ 10.2.4), MySQL (≥ 5.7.5), 甲骨文, PostGIS , SpatiaLite
接受單個地理字段或表達式並返回幾何的GeoJSON 表示。請注意,結果不是完整的GeoJSON 結構,而隻是GeoJSON 結構的geometry
關鍵內容。另請參閱GeoJSON 序列化程序。
例子:
>>> City.objects.annotate(json=AsGeoJSON('point')).get(name='Chicago').json
{"type":"Point","coordinates":[-87.65018,41.85039]}
關鍵字參數 | 說明 |
---|---|
bbox |
如果您希望邊界框包含在返回的 GeoJSON 中,請將其設置為 True 。在 Oracle 上被忽略。 |
crs |
如果您希望坐標參考係統包含在返回的 GeoJSON 中,請將其設置為 True 。在 MySQL 和 Oracle 上被忽略。 |
precision |
它可用於指定 GeoJSON 表示中坐標的有效位數 - 默認值為 8。在 Oracle 上忽略。 |
相關用法
- Python Django AsGML用法及代碼示例
- Python Django AsWKB用法及代碼示例
- Python Django AsKML用法及代碼示例
- Python Django AsWKT用法及代碼示例
- Python Ascii()用法及代碼示例
- Python Tweepy API.mentions_timeline()用法及代碼示例
- Python Tweepy API.get_user()用法及代碼示例
- Python Tweepy API.list_timeline()用法及代碼示例
- Python Django ACos用法及代碼示例
- Python Django Area用法及代碼示例
- Python Tweepy API.add_list_members()用法及代碼示例
- Python Django Abs用法及代碼示例
- Python Django AuthenticationForm.confirm_login_allowed用法及代碼示例
- Python Tweepy API.create_block()用法及代碼示例
- Python Django ATan用法及代碼示例
- Python Tweepy API.trends_closest()用法及代碼示例
- Python Django ArchiveIndexView用法及代碼示例
- Python Tweepy API.send_direct_message()用法及代碼示例
- Python Tweepy API.destroy_status()用法及代碼示例
- Python Tweepy API.destroy_saved_search()用法及代碼示例
- Python Django ArraySubquery用法及代碼示例
- Python Tweepy API.get_list()用法及代碼示例
- Python Tweepy API.favorites()用法及代碼示例
- Python Tweepy API.blocks_ids()用法及代碼示例
- Python Tweepy API.configuration()用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.contrib.gis.db.models.functions.AsGeoJSON。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。