Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ohmg/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ class LayerSetLayer(Schema):
tilejson: Optional[dict]
urls: dict
extent: Optional[list]
mask: Optional[dict]

@staticmethod
def resolve_mask(obj: Layer):
return json.loads(obj.mask.geojson) if obj.mask else None

@staticmethod
def resolve_urls(obj):
Expand All @@ -474,6 +479,7 @@ class LayerSetSchema(Schema):
map_id: str
tilejson: Optional[dict]
layers: List[LayerSetLayer]
layers_masked_ct: int
multimask_geojson: Optional[dict]
extent: Optional[tuple]
multimask_extent: Optional[tuple]
Expand All @@ -487,6 +493,10 @@ def resolve_id(obj):
def resolve_layers(obj):
return natsorted(obj.get_layers(), key=lambda k: k.title)

@staticmethod
def resolve_layers_masked_ct(obj):
return obj.get_layers().filter(mask__isnull=False).count()

@staticmethod
def resolve_name(obj):
return str(obj.category)
Expand Down
3 changes: 3 additions & 0 deletions ohmg/core/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def random_alnum(size=6):
("connecticut", "Connecticut"),
("delaware", "Delaware"),
("district of columbia", "District of Columbia"),
("distrito federal", "Distrito Federal"),
("florida", "Florida"),
("georgia", "Georgia"),
("hawaii", "Hawaii"),
Expand Down Expand Up @@ -113,6 +114,7 @@ def random_alnum(size=6):
"connecticut": "Conn.",
"delaware": "Del.",
"district of columbia": "D.C.",
"distrito federal": "D.F.",
"florida": "Fla.",
"georgia": "Ga.",
"hawaii": "Hawaii",
Expand Down Expand Up @@ -166,6 +168,7 @@ def random_alnum(size=6):
"connecticut": "cn",
"delaware": "de",
"district of columbia": "dc",
"distrito federal": "df",
"florida": "fl",
"georgia": "ga",
"hawaii": "hi",
Expand Down
6 changes: 4 additions & 2 deletions ohmg/extensions/iiif.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from django.conf import settings
from django.contrib.gis.gdal import CoordTransform, SpatialReference
from django.contrib.gis.geos import Polygon
Expand Down Expand Up @@ -30,8 +32,8 @@ def get_target(self):
if self.layer.mask:
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326)

coords = self.layer.mask.geojson["coordinates"][0]
mask_geojson = json.loads(self.layer.mask.geojson)
coords = mask_geojson["coordinates"][0]
ct = CoordTransform(SpatialReference("WGS84"), SpatialReference("EPSG:3857"))
polygon = Polygon(coords)
polygon.transform(ct)
Expand Down
2 changes: 2 additions & 0 deletions ohmg/extensions/loc_sanborn.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ def parse_location_info(self):
# get state from the last item in the item title, easy
state_names = [i[1] for i in STATE_CHOICES]
state_seg = title_segs[-1]
if state_seg.endswith("(Mexico)"):
state_seg = state_seg[:-8].rstrip()
if state_seg in state_names:
self.state = state_seg.lower()
# remove the location tag for the state
Expand Down
22 changes: 22 additions & 0 deletions ohmg/frontend/static/css/site_base.css
Original file line number Diff line number Diff line change
Expand Up @@ -609,3 +609,25 @@ img.lead-image {
padding: 0px 5px;
}
}

#step-list > div {
display: flex;
align-items: center;
padding-bottom: 5px;
margin-bottom: 5px;
border-bottom: dashed grey 1px;
}

#step-list > div:first-child {
padding-top: 5px;
border-top: dashed grey 1px;
}

#step-list div > div {
min-width: 85px;
}

#step-list div > p {
font-size: 1.25em;
margin-bottom: 0px;
}
Loading