| 1 |
from django.contrib.gis.db import models |
| 2 |
|
| 3 |
from ..utils import gisfield_may_be_null |
| 4 |
|
| 5 |
|
| 6 |
class NamedModel(models.Model): |
| 7 |
name = models.CharField(max_length=30) |
| 8 |
|
| 9 |
class Meta: |
| 10 |
abstract = True |
| 11 |
|
| 12 |
def __str__(self): |
| 13 |
return self.name |
| 14 |
|
| 15 |
|
| 16 |
class SouthTexasCity(NamedModel): |
| 17 |
"City model on projected coordinate system for South Texas." |
| 18 |
|
| 19 |
point = models.PointField(srid=32140) |
| 20 |
radius = models.IntegerField(default=10000) |
| 21 |
|
| 22 |
|
| 23 |
class SouthTexasCityFt(NamedModel): |
| 24 |
"Same City model as above, but U.S. survey feet are the units." |
| 25 |
|
| 26 |
point = models.PointField(srid=2278) |
| 27 |
|
| 28 |
|
| 29 |
class AustraliaCity(NamedModel): |
| 30 |
"City model for Australia, using WGS84." |
| 31 |
|
| 32 |
point = models.PointField() |
| 33 |
radius = models.IntegerField(default=10000) |
| 34 |
allowed_distance = models.FloatField(default=0.5) |
| 35 |
ref_point = models.PointField(null=True) |
| 36 |
|
| 37 |
|
| 38 |
class CensusZipcode(NamedModel): |
| 39 |
"Model for a few South Texas ZIP codes (in original Census NAD83)." |
| 40 |
|
| 41 |
poly = models.PolygonField(srid=4269) |
| 42 |
|
| 43 |
|
| 44 |
class SouthTexasZipcode(NamedModel): |
| 45 |
"Model for a few South Texas ZIP codes." |
| 46 |
|
| 47 |
poly = models.PolygonField(srid=32140, null=gisfield_may_be_null) |
| 48 |
|
| 49 |
|
| 50 |
class Interstate(NamedModel): |
| 51 |
"Geodetic model for U.S. Interstates." |
| 52 |
|
| 53 |
path = models.LineStringField() |
| 54 |
|
| 55 |
|
| 56 |
class SouthTexasInterstate(NamedModel): |
| 57 |
"Projected model for South Texas Interstates." |
| 58 |
|
| 59 |
path = models.LineStringField(srid=32140) |