Models¶
Geography models represent all geographic political divisions in the United States, their relationships and their geometric boundaries.
Division
¶
-
class
geography.models.
Division
(*args, **kwargs)¶ A political or administrative geography.
For example, a particular state, county, district, precinct or municipality.
Parameters: - id (UUIDField) – Id
- uid (CharField) – Uid
- slug (SlugField) – Slug
- name (CharField) – Name
- label (CharField) – Label
- short_label (CharField) – Short label
- parent (ForeignKey to
Division
) – Parent - level (ForeignKey to
DivisionLevel
) – Level - code (CharField) – Code representing a geography: FIPS code for states and counties, district number for districts, precinct number for precincts, etc.
- code_components (JSONField) – Component parts of code
- effective (BooleanField) – Effective
- effective_start (DateTimeField) – Effective start
- effective_end (DateTimeField) – Effective end
- intersecting (ManyToManyField) – Intersecting divisions intersect this one geographically but do not necessarily have a parent/child relationship. The relationship between a congressional district and a precinct is an example of an intersecting relationship.
DivisionLevel
¶
-
class
geography.models.
DivisionLevel
(*args, **kwargs)¶ Level of government or administration at which a division exists.
For example, federal, state, district, county, precinct, municipal.
Parameters: - id (UUIDField) – Id
- uid (CharField) – Uid
- slug (SlugField) – Slug
- name (CharField) – Name
- parent (ForeignKey to
DivisionLevel
) – Parent
Geometry
¶
-
class
geography.models.
Geometry
(*args, **kwargs)¶ The spatial representation (in topoJSON) of a Division.
Parameters: - id (UUIDField) – Id
- division (ForeignKey to
Division
) – Division - subdivision_level (ForeignKey to
DivisionLevel
) – Subdivision level - simplification (FloatField) – Minimum quantile of planar triangle areas for simplfying topojson.
- topojson (JSONField) – Topojson
- source (URLField) – Link to the source of this geography data.
- series (CharField) – Year of boundary series, e.g., 2016 TIGER/Line files.
- effective (BooleanField) – Effective
- effective_start (DateField) – Effective start
- effective_end (DateField) – Effective end
IntersectRelationship
¶
-
class
geography.models.
IntersectRelationship
(*args, **kwargs)¶ Each IntersectRelationship instance represents one side of a paired relationship between intersecting divisions.
The intersection field represents the decimal proportion of the to_division that intersects with the from_division. It’s useful for apportioning counts between the areas, for example, population statistics from census data.
Parameters: - id (AutoField) – Id
- from_division (ForeignKey to
Division
) – From division - to_division (ForeignKey to
Division
) – To division - intersection (DecimalField) – The portion of the to_division that intersects this division.
Point
¶
-
class
geography.models.
Point
(*args, **kwargs)¶ A point is a city.
Parameters: - id (AutoField) – Id
- geometry (ForeignKey to
Geometry
) – Geometry - lat (FloatField) – Latitude coordinate in decimal degrees.
- lon (FloatField) – Longitude coordinate in decimal degrees.
- attributes (JSONField) – Miscellaneous attributes on the point.
- threshold (PositiveSmallIntegerField) – A threshold in pixels above which to display this point.
- label (CharField) – Label
PointLabelOffset
¶
-
class
geography.models.
PointLabelOffset
(*args, **kwargs)¶ Offsets used to display a Point’s label.
Parameters: - id (AutoField) – Id
- point (ForeignKey to
Point
) – Point - x (SmallIntegerField) – Lateral offset in pixels.
- y (SmallIntegerField) – Vertical offset in pixels.
- threshold (PositiveSmallIntegerField) – A threshold in pixels above which to apply this offset.