2008-08-06 02:13:06 +08:00
|
|
|
from django.contrib.gis.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2008-08-06 02:13:06 +08:00
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2014-01-01 18:01:46 +08:00
|
|
|
class NamedModel(models.Model):
|
2008-08-06 02:13:06 +08:00
|
|
|
name = models.CharField(max_length=30)
|
2014-01-01 18:01:46 +08:00
|
|
|
|
2008-08-06 02:13:06 +08:00
|
|
|
objects = models.GeoManager()
|
2013-10-17 16:17:41 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class Meta:
|
|
|
|
abstract = True
|
|
|
|
app_label = 'distapp'
|
|
|
|
|
2013-10-17 16:17:41 +08:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
2008-08-06 02:13:06 +08:00
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class SouthTexasCity(NamedModel):
|
|
|
|
"City model on projected coordinate system for South Texas."
|
|
|
|
point = models.PointField(srid=32140)
|
|
|
|
|
|
|
|
|
|
|
|
class SouthTexasCityFt(NamedModel):
|
2008-08-06 02:13:06 +08:00
|
|
|
"Same City model as above, but U.S. survey feet are the units."
|
|
|
|
point = models.PointField(srid=2278)
|
2013-10-17 16:17:41 +08:00
|
|
|
|
2008-08-06 02:13:06 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class AustraliaCity(NamedModel):
|
2008-08-06 02:13:06 +08:00
|
|
|
"City model for Australia, using WGS84."
|
|
|
|
point = models.PointField()
|
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class CensusZipcode(NamedModel):
|
2008-08-06 02:13:06 +08:00
|
|
|
"Model for a few South Texas ZIP codes (in original Census NAD83)."
|
|
|
|
name = models.CharField(max_length=5)
|
|
|
|
poly = models.PolygonField(srid=4269)
|
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class SouthTexasZipcode(NamedModel):
|
2008-08-06 02:13:06 +08:00
|
|
|
"Model for a few South Texas ZIP codes."
|
|
|
|
name = models.CharField(max_length=5)
|
2010-03-30 06:20:38 +08:00
|
|
|
poly = models.PolygonField(srid=32140, null=True)
|
2008-08-06 02:13:06 +08:00
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class Interstate(NamedModel):
|
2008-08-06 02:13:06 +08:00
|
|
|
"Geodetic model for U.S. Interstates."
|
|
|
|
name = models.CharField(max_length=10)
|
2009-03-31 01:15:49 +08:00
|
|
|
path = models.LineStringField()
|
|
|
|
|
2013-11-03 04:12:09 +08:00
|
|
|
|
2014-01-01 18:01:46 +08:00
|
|
|
class SouthTexasInterstate(NamedModel):
|
2009-03-31 01:15:49 +08:00
|
|
|
"Projected model for South Texas Interstates."
|
|
|
|
name = models.CharField(max_length=10)
|
2013-10-17 16:17:41 +08:00
|
|
|
|