Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MapLibre
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Boris Mericskay
MapLibre
Commits
a19276ad
Commit
a19276ad
authored
3 years ago
by
Boris Mericskay
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
1c2a1a3b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Choropleth3DMap.html
+126
-0
126 additions, 0 deletions
Choropleth3DMap.html
with
126 additions
and
0 deletions
Choropleth3DMap.html
0 → 100644
+
126
−
0
View file @
a19276ad
<!DOCTYPE html>
<html>
<head>
<meta
charset=
'utf-8'
/>
<title></title>
<meta
name=
'viewport'
content=
'initial-scale=1,maximum-scale=1,user-scalable=no'
/>
<script
src=
"https://cdn.maptiler.com/maplibre-gl-js/v1.13.0-rc.4/mapbox-gl.js"
></script>
<link
href=
"https://cdn.maptiler.com/maplibre-gl-js/v1.13.0-rc.4/mapbox-gl.css"
rel=
"stylesheet"
/>
<style>
#map
{
position
:
absolute
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
0
;}
.Mypopup
.mapboxgl-popup-content
{
background-color
:
black
;
color
:
white
;
opacity
:
0.7
;
}
</style>
</head>
<body>
<div
id=
'map'
></div>
<script>
//Configuration de la carte
var
map
=
new
mapboxgl
.
Map
({
container
:
'
map
'
,
// container id
style
:
'
https://geoserveis.icgc.cat/contextmaps/positron.json
'
,
//Fond de carte
center
:
[
-
2.802
,
48.1
],
zoom
:
7.7
,
pitch
:
40
,
bearing
:
1
});
map
.
on
(
'
style.load
'
,
function
()
{
// Add data
map
.
addSource
(
'
Municipalities
'
,
{
type
:
'
geojson
'
,
data
:
'
https://raw.githubusercontent.com/mastersigat/data/main/communesBZH.geojson
'
});
// Municipalities layer
map
.
addLayer
({
'
id
'
:
'
Municipalities
'
,
'
type
'
:
'
fill-extrusion
'
,
'
source
'
:
'
Municipalities
'
,
'
layout
'
:
{
'
visibility
'
:
'
visible
'
},
'
paint
'
:
{
'
fill-extrusion-color
'
:
{
property
:
'
density
'
,
stops
:
[
[
20
,
'
#4d9221
'
],
[
50
,
'
#a1d76a
'
],
[
100
,
'
#e6f5d0
'
],
[
200
,
'
#fde0ef
'
],
[
500
,
'
#e9a3c9
'
],
[
1000
,
'
#c51b7d
'
],]},
'
fill-extrusion-height
'
:
{
'
property
'
:
'
POPULATION
'
,
'
stops
'
:
[[
100
,
10
],
[
100
,
100
],
[
200000
,
70000
]]
},
'
fill-extrusion-opacity
'
:
0.95
,
'
fill-extrusion-base
'
:
0
}
});
// Add Departments
map
.
addSource
(
'
lignes
'
,
{
type
:
'
geojson
'
,
data
:
'
https://raw.githubusercontent.com/mastersigat/data/main/Departements.geojson
'
});
map
.
addLayer
({
'
id
'
:
'
Lignes
'
,
'
type
'
:
'
line
'
,
'
source
'
:
'
lignes
'
,
'
paint
'
:
{
'
line-width
'
:
2.5
,
'
line-color
'
:
'
#111111
'
}
});
});
var
popup
=
new
mapboxgl
.
Popup
({
className
:
"
Mypopup
"
,
closeButton
:
false
,
closeOnClick
:
false
});
map
.
on
(
'
mousemove
'
,
function
(
e
)
{
var
features
=
map
.
queryRenderedFeatures
(
e
.
point
,
{
layers
:
[
'
Municipalities
'
]
});
map
.
getCanvas
().
style
.
cursor
=
(
features
.
length
)
?
'
pointer
'
:
''
;
if
(
!
features
.
length
)
{
popup
.
remove
();
return
;
}
var
feature
=
features
[
0
];
popup
.
setLngLat
(
feature
.
geometry
.
coordinates
)
.
setHTML
(
'
<b>
'
+
feature
.
properties
.
NOM_COM_M
+
'
</b>
'
)
.
addTo
(
map
);
});
// Ajout controle de navigation et echelle
map
.
addControl
(
new
mapboxgl
.
NavigationControl
({
position
:
'
top-right
'
}));
map
.
addControl
(
new
mapboxgl
.
ScaleControl
({
position
:
'
bottom-right
'
}));
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment