Skip to content

Commit

Permalink
Merge pull request #3 from sersanchus/fix_geometry_with_dim
Browse files Browse the repository at this point in the history
Completes the geometry type with Z when three dimensions are required
  • Loading branch information
miquelalzanillas authored May 15, 2024
2 parents 3025121 + a9d3add commit a2420f1
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 a2420f1

Please sign in to comment.