2016-11-05 10:35:58 +00:00
|
|
|
from django.contrib.gis.db import models
|
2008-08-05 18:13:06 +00:00
|
|
|
|
2015-02-10 15:07:44 +00:00
|
|
|
from ..utils import gisfield_may_be_null
|
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class NamedModel(models.Model):
|
2008-08-05 18:13:06 +00:00
|
|
|
name = models.CharField(max_length=30)
|
2014-01-01 10:01:46 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
abstract = True
|
|
|
|
|
2013-10-17 08:17:41 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
2008-08-05 18:13:06 +00:00
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class SouthTexasCity(NamedModel):
|
|
|
|
"City model on projected coordinate system for South Texas."
|
|
|
|
point = models.PointField(srid=32140)
|
2015-10-06 20:05:53 +00:00
|
|
|
radius = models.IntegerField(default=10000)
|
2014-01-01 10:01:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SouthTexasCityFt(NamedModel):
|
2008-08-05 18:13:06 +00:00
|
|
|
"Same City model as above, but U.S. survey feet are the units."
|
|
|
|
point = models.PointField(srid=2278)
|
2013-10-17 08:17:41 +00:00
|
|
|
|
2008-08-05 18:13:06 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class AustraliaCity(NamedModel):
|
2008-08-05 18:13:06 +00:00
|
|
|
"City model for Australia, using WGS84."
|
|
|
|
point = models.PointField()
|
2015-10-06 20:05:53 +00:00
|
|
|
radius = models.IntegerField(default=10000)
|
2019-08-17 14:32:56 +00:00
|
|
|
allowed_distance = models.FloatField(default=0.5)
|
2021-01-25 07:40:46 +00:00
|
|
|
ref_point = models.PointField(null=True)
|
2008-08-05 18:13:06 +00:00
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class CensusZipcode(NamedModel):
|
2008-08-05 18:13:06 +00:00
|
|
|
"Model for a few South Texas ZIP codes (in original Census NAD83)."
|
|
|
|
poly = models.PolygonField(srid=4269)
|
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class SouthTexasZipcode(NamedModel):
|
2008-08-05 18:13:06 +00:00
|
|
|
"Model for a few South Texas ZIP codes."
|
2014-08-21 16:47:57 +00:00
|
|
|
poly = models.PolygonField(srid=32140, null=gisfield_may_be_null)
|
2008-08-05 18:13:06 +00:00
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class Interstate(NamedModel):
|
2008-08-05 18:13:06 +00:00
|
|
|
"Geodetic model for U.S. Interstates."
|
2009-03-30 17:15:49 +00:00
|
|
|
path = models.LineStringField()
|
|
|
|
|
2013-11-02 20:12:09 +00:00
|
|
|
|
2014-01-01 10:01:46 +00:00
|
|
|
class SouthTexasInterstate(NamedModel):
|
2009-03-30 17:15:49 +00:00
|
|
|
"Projected model for South Texas Interstates."
|
2014-01-01 10:52:56 +00:00
|
|
|
path = models.LineStringField(srid=32140)
|