Skip to content

Commit

Permalink
New webmap is finally released!!
Browse files Browse the repository at this point in the history
  • Loading branch information
kauevestena committed Aug 28, 2024
1 parent d0286e0 commit 083c0df
Show file tree
Hide file tree
Showing 7 changed files with 1,043 additions and 3 deletions.
Binary file added assets/page_logo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
968 changes: 968 additions & 0 deletions deprecated/legacy/map.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions webmap/create_webmap_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# boundaries:
params['bounds'] = get_boundaries_bbox()

# updating the node's url:
params['node_url'] = node_homepage_url

# # generating the "sources" and layernames:
params.update(get_sources(only_urls=True))

Expand Down
68 changes: 67 additions & 1 deletion webmap/webmap_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@
text-decoration: underline;
/* Adds underline on hover */
}

.logo_img{
position: fixed;
left: 2px;
top: 2px;
z-index: 99999999999999999;
}

.responsive {
max-width: 60%;
height: auto;
}
</style>

<link rel="icon" type="image/x-icon"
Expand All @@ -127,7 +139,21 @@
<div id="style-changer">
<select id="style-selector"></select>
</div>
<div id="map"></div>
<div id="map">

<a href="https://kauevestena.github.io/opensidewalkmap_beta/" id="node_link">
<img
src="https://kauevestena.github.io/opensidewalkmap_beta/oswm_codebase/assets/page_logo.png"
alt="OSWM Page Logo"
title="Click for more OSWM Node's Resources!!"
class="logo_img responsive"
></img>
</a>

</div>



<script type="text/javascript">

// Global Control Variables
Expand Down Expand Up @@ -185,6 +211,31 @@

);

const homePosition = {
center: [144, -37],
};

function addHomeButton(map) {
class HomeButton {
onAdd(map) {
const div = document.createElement("div");
div.className = "mapboxgl-ctrl mapboxgl-ctrl-group";
div.innerHTML = `<button>
<svg focusable="false" viewBox="0 0 24 24" aria-hidden="true" style="font-size: 20px;"><title>Reset map</title><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"></path></svg>
</button>`;
div.addEventListener("contextmenu", (e) => e.preventDefault());
// div.addEventListener("click", () => map.flyTo(homePosition));

return div;
}
}

// const homeButton =
map.addControl(new HomeButton(), "top-left");

}



// add controls
map.addControl(new maplibregl.NavigationControl());
Expand Down Expand Up @@ -271,6 +322,21 @@
}


// Function used to update element's attributes:
function changeElementAttribute(elementId, attributeName, attributeValue) {
// Get the element using its ID
const element = document.getElementById(elementId);

if (element) {
// Set the specified attribute with the provided value
element[attributeName] = attributeValue;
} else {
console.error(`Element with ID "${elementId}" not found.`);
}
}

changeElementAttribute("node_link","href",params['node_url']);


// Function to set up hover effect for a specific layer
function setupHoverEffect(layerName, sourceName, sourceLayerName) {
Expand Down
2 changes: 1 addition & 1 deletion webmap/webmap_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
webmap_params_original_path = 'oswm_codebase/webmap/webmap_params.json'
webmap_params_path = 'webmap_params.json'
webmap_base_path = 'oswm_codebase/webmap/webmap_base.html'
webmap_path = 'map_new.html'
webmap_path = 'map.html'

# mapping geometry types to maplibre style
map_geom_type_mapping = {
Expand Down
1 change: 1 addition & 0 deletions webmap/webmap_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
-25.465
],
"basemap_url": "https://a.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",
"node_homepage" : "https://kauevestena.github.io/opensidewalkmap_beta/",
"sidewalks_url": "https://kauevestena.github.io/opensidewalkmap_beta/data/tiles/sidewalks.pmtiles",
"crossings_url": "https://kauevestena.github.io/opensidewalkmap_beta/data/tiles/crossings.pmtiles",
"kerbs_url": "https://kauevestena.github.io/opensidewalkmap_beta/data/tiles/kerbs.pmtiles",
Expand Down
4 changes: 3 additions & 1 deletion workflows/data_daily_updating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:

- run: python oswm_codebase/generation/vec_tiles_gen.py

- run: python oswm_codebase/create_webmap.py
# - run: python oswm_codebase/create_webmap.py

- run: python oswm_codebase/webmap/create_webmap_new.py

- run: python oswm_codebase/data_quality/tag_values_checking.py

Expand Down

0 comments on commit 083c0df

Please sign in to comment.