-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
4,371 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
'''Django admin configuration for bpz''' | ||
|
||
from django.contrib.gis import admin | ||
from .models import HomeOwnersAssociation, BOACase, TMAPCCase | ||
|
||
geo_admin = admin.OSMGeoAdmin | ||
|
||
|
||
class HomeOwnersAssociationAdmin(geo_admin): | ||
pass | ||
|
||
|
||
class BOACaseAdmin(geo_admin): | ||
pass | ||
|
||
|
||
class TMAPCCaseAdmin(geo_admin): | ||
pass | ||
|
||
|
||
admin.site.register(HomeOwnersAssociation, HomeOwnersAssociationAdmin) | ||
admin.site.register(BOACase, BOACaseAdmin) | ||
admin.site.register(TMAPCCase, TMAPCCaseAdmin) |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django.contrib.gis.utils import LayerMapping | ||
|
||
from bpz.models import BOACase | ||
|
||
'''Import Board of Adjustment cases data | ||
TODO: | ||
- Convert date to string | ||
- Convert \/ in URLs | ||
- Don't duplicate existing data | ||
- Update existing data | ||
''' | ||
|
||
|
||
class Command(BaseCommand): | ||
args = '<home-owners-associatons.json>' | ||
help = 'Imports Home Owners Association GeoJSON' | ||
|
||
def handle(self, *args, **options): | ||
if len(args) != 1: | ||
raise CommandError('Must pass exactly one json file to import') | ||
hoa_json = args[0] | ||
lm = LayerMapping( | ||
BOACase, hoa_json, BOACase._mapping, | ||
transform=False, encoding='iso-8859-1') | ||
lm.save(strict=False, verbose=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django.contrib.gis.utils import LayerMapping | ||
|
||
from bpz.models import HomeOwnersAssociation | ||
|
||
'''Import Home Owners Association data | ||
TODO: | ||
- Don't duplicate existing data | ||
- Exclude data with object_id = 0? | ||
- Import neighborhoods with no geometry? | ||
- Handle names with \/ | ||
- strict = True? | ||
''' | ||
|
||
|
||
class Command(BaseCommand): | ||
args = '<home-owners-associatons.json>' | ||
help = 'Imports Home Owners Association GeoJSON' | ||
|
||
def handle(self, *args, **options): | ||
if len(args) != 1: | ||
raise CommandError('Must pass exactly one json file to import') | ||
hoa_json = args[0] | ||
lm = LayerMapping( | ||
HomeOwnersAssociation, hoa_json, HomeOwnersAssociation._mapping, | ||
transform=False, encoding='utf-8') | ||
lm.save(strict=False, verbose=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django.contrib.gis.utils import LayerMapping | ||
|
||
from bpz.models import TMAPCCase | ||
|
||
'''Import Tulsa Metropolitan Area Planning Commission case data | ||
TODO: | ||
- Convert date to string | ||
- Convert \/ in URLs | ||
- Don't duplicate existing data | ||
- Update existing data | ||
- Limit / validate case types? ('PUD Site Plan\r\n\r\nPUD Site Plan') | ||
''' | ||
|
||
|
||
class Command(BaseCommand): | ||
args = '<home-owners-associatons.json>' | ||
help = 'Imports Home Owners Association GeoJSON' | ||
|
||
def handle(self, *args, **options): | ||
if len(args) != 1: | ||
raise CommandError('Must pass exactly one json file to import') | ||
hoa_json = args[0] | ||
lm = LayerMapping( | ||
TMAPCCase, hoa_json, TMAPCCase._mapping, | ||
transform=False, encoding='iso-8859-1') | ||
lm.save(strict=True, verbose=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# -*- coding: utf-8 -*- | ||
# flake8: noqa | ||
from south.utils import datetime_utils as datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
# Adding model 'HomeOwnersAssociation' | ||
db.create_table(u'bpz_homeownersassociation', ( | ||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
('object_id', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), | ||
('name', self.gf('django.db.models.fields.CharField')(max_length=50)), | ||
('hoa_name', self.gf('django.db.models.fields.CharField')(max_length=50)), | ||
('geom', self.gf('django.contrib.gis.db.models.fields.GeometryField')()), | ||
)) | ||
db.send_create_signal(u'bpz', ['HomeOwnersAssociation']) | ||
|
||
# Adding model 'BOACase' | ||
db.create_table(u'bpz_boacase', ( | ||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
('object_id', self.gf('django.db.models.fields.IntegerField')()), | ||
('case_id', self.gf('django.db.models.fields.CharField')(max_length=15)), | ||
('status', self.gf('django.db.models.fields.CharField')(max_length=10)), | ||
('location', self.gf('django.db.models.fields.CharField')(max_length=50)), | ||
('link', self.gf('django.db.models.fields.URLField')(max_length=200)), | ||
('hearing_date_str', self.gf('django.db.models.fields.CharField')(max_length=15)), | ||
('geom', self.gf('django.contrib.gis.db.models.fields.GeometryField')()), | ||
)) | ||
db.send_create_signal(u'bpz', ['BOACase']) | ||
|
||
# Adding model 'TMAPCCase' | ||
db.create_table(u'bpz_tmapccase', ( | ||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), | ||
('object_id', self.gf('django.db.models.fields.IntegerField')()), | ||
('case_id', self.gf('django.db.models.fields.CharField')(max_length=50)), | ||
('status', self.gf('django.db.models.fields.CharField')(max_length=10)), | ||
('location', self.gf('django.db.models.fields.CharField')(max_length=50)), | ||
('link', self.gf('django.db.models.fields.URLField')(max_length=200)), | ||
('case_type', self.gf('django.db.models.fields.CharField')(max_length=30)), | ||
('hearing_date_str', self.gf('django.db.models.fields.CharField')(max_length=15)), | ||
('geom', self.gf('django.contrib.gis.db.models.fields.MultiPolygonField')()), | ||
)) | ||
db.send_create_signal(u'bpz', ['TMAPCCase']) | ||
|
||
|
||
def backwards(self, orm): | ||
# Deleting model 'HomeOwnersAssociation' | ||
db.delete_table(u'bpz_homeownersassociation') | ||
|
||
# Deleting model 'BOACase' | ||
db.delete_table(u'bpz_boacase') | ||
|
||
# Deleting model 'TMAPCCase' | ||
db.delete_table(u'bpz_tmapccase') | ||
|
||
|
||
models = { | ||
u'bpz.boacase': { | ||
'Meta': {'object_name': 'BOACase'}, | ||
'case_id': ('django.db.models.fields.CharField', [], {'max_length': '15'}), | ||
'geom': ('django.contrib.gis.db.models.fields.GeometryField', [], {}), | ||
'hearing_date_str': ('django.db.models.fields.CharField', [], {'max_length': '15'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'link': ('django.db.models.fields.URLField', [], {'max_length': '200'}), | ||
'location': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
'object_id': ('django.db.models.fields.IntegerField', [], {}), | ||
'status': ('django.db.models.fields.CharField', [], {'max_length': '10'}) | ||
}, | ||
u'bpz.homeownersassociation': { | ||
'Meta': {'object_name': 'HomeOwnersAssociation'}, | ||
'geom': ('django.contrib.gis.db.models.fields.GeometryField', [], {}), | ||
'hoa_name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
'object_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) | ||
}, | ||
u'bpz.tmapccase': { | ||
'Meta': {'object_name': 'TMAPCCase'}, | ||
'case_id': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
'case_type': ('django.db.models.fields.CharField', [], {'max_length': '30'}), | ||
'geom': ('django.contrib.gis.db.models.fields.MultiPolygonField', [], {}), | ||
'hearing_date_str': ('django.db.models.fields.CharField', [], {'max_length': '15'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'link': ('django.db.models.fields.URLField', [], {'max_length': '200'}), | ||
'location': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
'object_id': ('django.db.models.fields.IntegerField', [], {}), | ||
'status': ('django.db.models.fields.CharField', [], {'max_length': '10'}) | ||
} | ||
} | ||
|
||
complete_apps = ['bpz'] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,112 @@ | ||
'''Models for bpz''' | ||
# from django.db import models | ||
from __future__ import unicode_literals | ||
|
||
from django.contrib.gis.db import models | ||
from django.utils.encoding import python_2_unicode_compatible | ||
|
||
|
||
@python_2_unicode_compatible | ||
class BOACase(models.Model): | ||
'''Board of Adjustment Case | ||
Model generated w/ ogrinspect. Omitted fields: | ||
SHAPE_Leng - derive from geometry | ||
SHAPE_Area - derive from geometry | ||
''' | ||
|
||
object_id = models.IntegerField() | ||
case_id = models.CharField(max_length=15) | ||
status = models.CharField( | ||
max_length=10, choices=[(x, x) for x in ( | ||
'Pending', 'Continued', 'Approved', 'Deny')]) | ||
location = models.CharField(max_length=50) | ||
link = models.URLField() | ||
hearing_date_str = models.CharField(max_length=15) | ||
geom = models.GeometryField(srid=4326) | ||
objects = models.GeoManager() | ||
|
||
_mapping = { | ||
'object_id': 'OBJECTID', | ||
'case_id': 'Case_', | ||
'status': 'Status', | ||
'location': 'Location', | ||
'link': 'Link', | ||
'hearing_date_str': 'Date_', | ||
'geom': 'UNKNOWN', | ||
} | ||
|
||
class Meta: | ||
verbose_name = 'BOA Case' | ||
|
||
def __str__(self): | ||
return self.case_id | ||
|
||
|
||
@python_2_unicode_compatible | ||
class HomeOwnersAssociation(models.Model): | ||
'''Home Owners Association | ||
Model generated w/ ogrinspect. Omitted fields: | ||
Id - Always 0 | ||
Umbrella - 'N' or null | ||
Shape_Leng - derive from geometry | ||
Spape_Area - derive from geometry | ||
''' | ||
|
||
object_id = models.IntegerField(null=True, blank=True) | ||
name = models.CharField(max_length=50) | ||
hoa_name = models.CharField(max_length=50) | ||
geom = models.GeometryField(srid=4326) | ||
objects = models.GeoManager() | ||
|
||
_mapping = { | ||
'object_id': 'OBJECTID', | ||
'name': 'Name', | ||
'hoa_name': 'HOA_Name', | ||
'geom': 'UNKNOWN', | ||
} | ||
|
||
class Meta: | ||
verbose_name = 'Home Owners Association' | ||
|
||
def __str__(self): | ||
return self.name or '<unnamed>' | ||
|
||
|
||
@python_2_unicode_compatible | ||
class TMAPCCase(models.Model): | ||
'''Tulsa Metropolitan Area Planning Commission Case | ||
Model generated w/ ogrinspect. Omitted fields: | ||
SHAPE_Leng - derive from geometry | ||
SHAPE_Area - derive from geometry | ||
''' | ||
|
||
object_id = models.IntegerField() | ||
case_id = models.CharField(max_length=50) | ||
status = models.CharField( | ||
max_length=10, choices=[(x, x) for x in ( | ||
'Pending', 'Continued', 'Approved', 'Deny')]) | ||
location = models.CharField(max_length=50) | ||
link = models.URLField() | ||
case_type = models.CharField(max_length=30) | ||
hearing_date_str = models.CharField(max_length=15) | ||
geom = models.MultiPolygonField(srid=4326) | ||
objects = models.GeoManager() | ||
|
||
_mapping = { | ||
'object_id': 'OBJECTID', | ||
'case_id': 'Case_', | ||
'status': 'Status', | ||
'location': 'Location', | ||
'link': 'Link', | ||
'case_type': 'Type', | ||
'hearing_date_str': 'Date_', | ||
'geom': 'MULTIPOLYGON', | ||
} | ||
|
||
class Meta: | ||
verbose_name = 'TMAPC Case' | ||
|
||
def __str__(self): | ||
return self.case_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters