2016-11-05 18:35:58 +08:00
|
|
|
from django.contrib.gis.db import models
|
2016-06-14 22:18:33 +08:00
|
|
|
from django.contrib.gis.gdal import HAS_GDAL
|
2015-06-19 23:46:03 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
if HAS_GDAL:
|
|
|
|
class RasterModel(models.Model):
|
|
|
|
rast = models.RasterField('A Verbose Raster Name', null=True, srid=4326, spatial_index=True, blank=True)
|
|
|
|
rastprojected = models.RasterField('A Projected Raster Table', srid=3086, null=True)
|
|
|
|
geom = models.PointField(null=True)
|
2016-04-22 00:03:14 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
class Meta:
|
|
|
|
required_db_features = ['supports_raster']
|
2016-04-22 00:03:14 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
def __str__(self):
|
|
|
|
return str(self.id)
|
2016-04-22 00:03:14 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
class RasterRelatedModel(models.Model):
|
|
|
|
rastermodel = models.ForeignKey(RasterModel, models.CASCADE)
|
2015-06-19 23:46:03 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
class Meta:
|
|
|
|
required_db_features = ['supports_raster']
|
2015-06-19 23:46:03 +08:00
|
|
|
|
2016-06-14 22:18:33 +08:00
|
|
|
def __str__(self):
|
|
|
|
return str(self.id)
|