Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from OpenLayers to MapLibre GL #63

Merged
merged 38 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a2a49a7
Partially working maplibre-gl implementation
jjnesbitt Aug 26, 2024
4f7d02a
WIP
jjnesbitt Aug 27, 2024
fb3733d
Rename server map layers to dataset layers
jjnesbitt Aug 28, 2024
cc3363d
Fix basic rendering issues
jjnesbitt Aug 28, 2024
cb420de
Fix active layer ordering
jjnesbitt Aug 28, 2024
b741008
Fix opacity rendering
jjnesbitt Sep 3, 2024
b645430
Remove use of DatasetLayer.openlayer
jjnesbitt Sep 3, 2024
6008211
Fix updateBaseLayer and clearMapLayers
jjnesbitt Sep 4, 2024
2f23a46
Place toggled layer on top if not created
jjnesbitt Sep 4, 2024
8380790
Improve types
jjnesbitt Sep 4, 2024
ec9a7db
Correctly display vector layer points
jjnesbitt Sep 4, 2024
b205faa
Display region datasets correctly
jjnesbitt Sep 4, 2024
9148592
Clean up unnecessary code and fix type issues
jjnesbitt Sep 4, 2024
55c6a43
Simplify layer creation
jjnesbitt Sep 4, 2024
7045bb2
Fix map click handler
jjnesbitt Sep 4, 2024
69a95f8
Fix zoom to region button
jjnesbitt Sep 4, 2024
000c2e3
Remove region grouping functionality in map tooltip
jjnesbitt Sep 5, 2024
6614442
Apply style changes to all dataset layers by default
jjnesbitt Sep 5, 2024
4fe1137
Fix circle layer opacity issue
jjnesbitt Sep 6, 2024
094f5d9
Improve line and circle rendering
jjnesbitt Sep 6, 2024
01d4f3b
Fix raster and tooltip display
jjnesbitt Sep 4, 2024
35b397f
Consolidate tooltip manipulation code
jjnesbitt Sep 11, 2024
41b1ea3
Clean up raster colormap code
jjnesbitt Sep 12, 2024
dd23ee4
Fix layout of zoom to region button
jjnesbitt Sep 12, 2024
2212141
Enable network and GCC features
jjnesbitt Sep 12, 2024
ae6b387
Remove references to openlayers
jjnesbitt Sep 13, 2024
07df107
Use OSM instead of map tiler
jjnesbitt Sep 13, 2024
2a824d4
Fix linting errors
jjnesbitt Sep 16, 2024
f0c4ab2
Ensure map layers are fetched in sorted order
jjnesbitt Sep 16, 2024
994aad4
Fix bug in raster tile request param construction
jjnesbitt Sep 17, 2024
870434f
Remove unused and commented out code
jjnesbitt Sep 17, 2024
4d6728c
Ignore and add TODO to non-null assertion
jjnesbitt Sep 17, 2024
31e5391
Remove nested array in network endpoint
jjnesbitt Sep 17, 2024
143cc31
Add comment to explain unavoidable error
jjnesbitt Sep 17, 2024
f695031
Fix bug with reset network button
jjnesbitt Sep 18, 2024
3ef6609
Show raster and flood map layers in simulations panel
jjnesbitt Sep 23, 2024
efc9a4f
Add ts-ignore statements
jjnesbitt Sep 24, 2024
fc59de7
Remove TODOs
jjnesbitt Sep 25, 2024
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
1 change: 1 addition & 0 deletions uvdat/core/models/map_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Meta:

class RasterMapLayer(AbstractMapLayer):
cloud_optimized_geotiff = S3FileField()
# TODO: Store data x/y min/max bounds on model

def get_image_data(self, resolution: float = 1.0):
with tempfile.TemporaryDirectory() as tmp:
Expand Down
22 changes: 10 additions & 12 deletions uvdat/core/rest/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,16 @@ def network(self, request, **kwargs):
networks = []
for network in dataset.networks.all():
networks.append(
[
{
'nodes': [
uvdat_serializers.NetworkNodeSerializer(n).data
for n in NetworkNode.objects.filter(network=network)
],
'edges': [
uvdat_serializers.NetworkEdgeSerializer(e).data
for e in NetworkEdge.objects.filter(network=network)
],
}
]
{
'nodes': [
uvdat_serializers.NetworkNodeSerializer(n).data
for n in NetworkNode.objects.filter(network=network)
],
'edges': [
uvdat_serializers.NetworkEdgeSerializer(e).data
for e in NetworkEdge.objects.filter(network=network)
],
}
)
return HttpResponse(json.dumps(networks), status=200)

Expand Down
4 changes: 0 additions & 4 deletions uvdat/core/rest/map_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
ST_Transform(t.geometry, %(srid)s),
ST_Transform(bounds.geom, %(srid)s)
)
AND (
ST_GeometryType(ST_AsText(t.geometry)) != 'ST_Point'
OR %(z)s >= 16
)
)
SELECT ST_AsMVT(mvtgeom.*) FROM mvtgeom
;
Expand Down
10 changes: 9 additions & 1 deletion uvdat/core/rest/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,20 @@ class Meta:


class VectorMapLayerSerializer(serializers.ModelSerializer, AbstractMapLayerSerializer):
dataset_category = serializers.SerializerMethodField()

def get_dataset_category(self, obj: VectorMapLayer):
if obj.dataset is None:
raise Exception('map layer with null dataset!')

return obj.dataset.category

class Meta:
model = VectorMapLayer
exclude = ['geojson_file']


class VectorMapLayerDetailSerializer(serializers.ModelSerializer, AbstractMapLayerSerializer):
class VectorMapLayerDetailSerializer(VectorMapLayerSerializer):
derived_region_id = serializers.SerializerMethodField('get_derived_region_id')

def get_derived_region_id(self, obj):
Expand Down
3 changes: 3 additions & 0 deletions web/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VUE_APP_OAUTH_CLIENT_ID=cBmD6D6F2YAmMWHNQZFPUr4OpaXVpW5w4Thod6Kj
VUE_APP_API_ROOT=http://localhost:8000/api/v1
VUE_APP_OAUTH_API_ROOT=http://localhost:8000/oauth/
1 change: 1 addition & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
# local env files
.env.local
.env.*.local
.env

# Log files
npm-debug.log*
Expand Down
Loading
Loading