... で実装された GEOS ジオメトリルーチンへの BSD ライセンスのインターフェイス。 Loosely-coupled to GeoDjango. For example, GEOSGeometry objects may be used outside of a Django project/application. In other words, no need to have DJANGO_SETTINGS_MODULE set or ... use a database, etc. ミュータビリティ (Mutability): GEOSGeometry オブジェクトは変更可能です。 クロスプラットフォームでテストされています。 チュートリアル このセクションには、 GEOSGeometry ... オブジェクトの簡単な紹介とチュートリアルが含まれています。 ジオメトリを作成する GEOSGeometry objects may be created in a few ways. The first is to simply instantiate the object on some spatial input -- the following ... ... 、その点に注意してください: from django.contrib.gis.feeds import Feed class MyFeed ( Feed ): # First, as a class attribute. geometry = ... item_geometry = ... # Also a function with no arguments def geometry ( self ): ... def item_geometry ( self ): ... # ... And as a function with a single argument def geometry ( self , obj ): ... def item_geometry ( self , item ): ... geometry ( obj ) get_object() で返されたオブジェクトを受け取り、 ... feed のジオメトリを返します。通常、これは GEOSGeometry インスタンスであり、ポイントまたはボックスを表すタプルであることもあります。例えば: class ZipcodeFeed ( Feed ): def geomet ... ... トリフィールド型は OpenGIS Simple Features 仕様 [ 1 ] に対応しています。ラスターデータに対するこのような標準は存在しません。 GeometryField class GeometryField [ソース] ジオメトリフィールドの基本クラス。 PointField class PointField [ソース] Point を格納しま ... eld [ソース] MultiLineString を格納します。 MultiPolygonField class MultiPolygonField [ソース] MultiPolygon を格納します。 GeometryCollectionField class GeometryCollectionField [ソース] GeometryCollection を格納します。 RasterField class RasterField [ソー ... 84 、単位は緯度経度)。 Setting the SRID to -1 disables automatic SRID transformations when saving geometries. The assigned geometry's SRID is set to -1 , discarding any explicit SRID it had. SRID の選択 Choosing an appropriate SRID for your model is an i ... ... ンに加えて、 geojson シリアライザは serializers.serialize() によって呼び出されたときに、以下の追加オプションを受け付けます: geometry_field : GeoJSON フィーチャの geometry キーに使用するジオメトリフィールド名を含む文字列。これは、複数のジオメトリフィールド ... : GeoJSONフィーチャの id キーに使用するフィールド名を含む文字列。デフォルトではオブジェクトの主キーが使用されます。 srid : geometry の内容に使用する SRID。デフォルトは 4326 (WGS 84) です。 fields オプションは、他のすべてのシリアライザと同様に機能し、 pro ... m django.core.serializers import serialize from my_app.models import City serialize ( "geojson" , City . objects . all (), geometry_field = "point" , fields = [ "name" ]) 出力は以下の通りです: { "type" : "FeatureCollection" , "features" : [ { "type" : "F ... ... .shp' using driver `ESRI Shapefile' successful. Layer name: TM_WORLD_BORDERS-0.3 Metadata: DBF_DATE_LAST_UPDATE=2008-07-30 Geometry: Polygon Feature Count: 246 Extent: (-180.000000, -90.000000) - (180.000000, 83.623596) Layer SRS WKT: GEOGCRS["WGS 84", D ... .shp' using driver `ESRI Shapefile' successful. Layer name: TM_WORLD_BORDERS-0.3 Metadata: DBF_DATE_LAST_UPDATE=2008-07-30 Geometry: Polygon Feature Count: 246 Extent: (-180.000000, -90.000000) - (180.000000, 83.623596) Layer SRS WKT: GEOGCRS["WGS 84", D ... els . IntegerField ( "Sub-Region Code" ) lon = models . FloatField () lat = models . FloatField () # GeoDjango-specific: a geometry field (MultiPolygonField) mpoly = models . MultiPolygonField () # Returns the string representation of the model. def __st ... ... oly__isvalid = True ) バックエンド 等価なSQL MariaDB, MySQL, PostGIS, SpatiaLite ST_IsValid(poly) Oracle SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(poly, 0.05) = 'TRUE' Changed in Django 6.0: MariaDB 12.0.1 以降のサポートが追加されました。 geom_type New in ... Django 6.0. 利用可能なDB : PostGIS , Oracle 23c+, MariaDB, MySQL, SpatiaLite Returns the geometry type of the geometry field. 実装例: Zipcode . objects . filter ( poly__geom_type = "POLYGON" ) バックエンド 等価なSQL Post ... GIS GeometryType(geom) MariaDB ST_GeometryType(geom) MySQL ST_GeometryType(geom) Oracle SDO_GEOMETRY.GET_GTYPE(geom) SpatiaLite Geometr ... ... stance.km is the distance value in kilometers. See 測定オブジェクト for usage details and the list of サポートされる単位 . GeometryDistance class GeometryDistance ( expr1 , expr2 , ** extra ) [ソース] 利用可能なDB : PostGIS 2つの地理情報フィールドまたは式 ... ew in Django 6.0. class Rotate ( expression , angle , origin = None , ** extra ) [ソース] 利用可能なDB : PostGIS Rotates a geometry by a specified angle around the origin. Optionally, the rotation can be performed around a point, defined by the origin pa ... gs , ** extra ) [ソース] 利用可能なDB : PostGIS , SpatiaLite Accepts a single geographic field or expression and returns a geometry with all points snapped to the given grid. How the geometry is snapped to the grid depends on how many numeric (either flo ... ... ... curity policy . バグ修正 Fixed a class of bugs in Django 5.2.17 that allowed bypassing the depth limiter for deeply nested geometry collections ( CVE 2026-15830 ). The new algorithm treats WKB and WKT inputs more consistently and also fixes a rare case w ... here a valid geometry could have been rejected. Fixed a data loss issue in Django 4.0 where network rasters were deleted by GeoDjango when close ... ... issue has severity "low" according to the Django security policy . CVE-2026-111211: Potential log injection via unescaped geometry form values GeometryField and its widgets logged invalid submitted values directly, allowing control characters (e.g. newl ... oordinate reference system (CRS) by URL. Since GDAL still resolves these URLs, any validation, save, or query path where a geometry is instantiated from user input allowed an attacker to submit a malicious CRS that would make a network request as the Dja ... ngo process user, or read a file, or both. Lookups against spatial fields , the GeometryField form field, and GEOSGeometry now reject GeoJSON geometries with CRS references to external resources. The DataSource ... 2026年10月08日