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