Skip to content

Commit

Permalink
fix(postgis type): completes the geometry type with z when three dime…
Browse files Browse the repository at this point in the history
…nsions are required
  • Loading branch information
sersanchus committed May 14, 2024
1 parent ca5e7a7 commit a9d3add
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base_geoengine/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ class GeoField(fields.Field):

@property
def column_type(self):
return ("geometry", f"geometry({self.geo_type.upper()}, {self.srid})")
postgis_geom_type = self.geo_type.upper() if self.geo_type else "GEOMETRY"
if self.dim == "3":
postgis_geom_type += "Z"
elif self.dim == "4":
postgis_geom_type += "ZM"
return ("geometry", f"geometry({postgis_geom_type}, {self.srid})")

def convert_to_column(self, value, record, values=None):
"""Convert value to database format
Expand Down

0 comments on commit a9d3add

Please sign in to comment.