Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hfu committed Oct 1, 2024
1 parent 5b589c7 commit 2cd7de2
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 116 deletions.
57 changes: 0 additions & 57 deletions docs/addLayers_003.js

This file was deleted.

15 changes: 0 additions & 15 deletions docs/addSources_003.js

This file was deleted.

74 changes: 30 additions & 44 deletions docs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const API_URL = "https://chosashi-data.org/amx/sticky_note_map/api/";
var data_Lng = "";
var data_Lat = "";
var ZoomLv = "";
var user = "";
var Lng = "";
var Lat = "";
var data = "";
let map = "";

function Flyto_Point(data_Lng, data_Lat, ZoomLv) {
map.flyTo({
Expand All @@ -21,16 +26,10 @@ function Flyto_Point(data_Lng, data_Lat, ZoomLv) {
}, 500)
}

var user = "";
var Lng = "";
var Lat = "";
var data = "";

function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

// アクセスカウント追加
var Update_Access_Count = fetch(API_URL, {
method: 'POST',
headers: {
Expand Down Expand Up @@ -307,48 +306,33 @@ function disp_point_limit12(data) {
})
}

setInterval(Update_ShareInfo, 1000 * 60);

var map = new maplibregl.Map({
container: 'map',
hash: true,
style: {
"version": 8,
"name": "Optimal_GSI_Shirado",
"glyphs": "https://glyphs.geolonia.com/{fontstack}/{range}.pbf",
"sprite": "https://gsi-cyberjapan.github.io/optimal_bvmap/sprite/std",
"sources": {},
"layers": []
},
center: [139.75417, 36.50],
zoom: 1,
minZoom: 1,
maxZoom: 23,
});


//ジャンプ(現在地)
function getLocation(getLatLng) {
map.flyTo({
center: [getLatLng.coords.longitude, getLatLng.coords.latitude],
zoom: 17,
speed: 2.5,
curve: 1
});
};


map.on('load', function() {

// ソース追加
addSources();
map.flyTo({
center: [getLatLng.coords.longitude, getLatLng.coords.latitude],
zoom: 17,
speed: 2.5,
curve: 1
});
};

// レイヤ追加
addLayers();
setInterval(Update_ShareInfo, 1000 * 60);

(async () => {
let style = await fetch('style.json').then(resp => resp.json())

map = new maplibregl.Map({
container: 'map',
hash: true,
style: style,
center: [139.75417, 36.50],
zoom: 1,
minZoom: 1,
maxZoom: 23,
})

// 現在地取得
ZoomLv = map.getZoom();
map.on('load', function() {
ZoomLv = map.getZoom();
//初期ズームレベルの時は、現在地ジャンプ
if (ZoomLv == 1) {
// 1.0秒遅延してジャンプ
Expand Down Expand Up @@ -820,4 +804,6 @@ map.on('movestart', function() {
// popup_contextmenu.remove();

});
//################# 画面移動 #################
//################# 画面移動 #################

})()
69 changes: 69 additions & 0 deletions docs/style.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"version": 8,
"name": "Optimal_GSI_Shirado",
"glyphs": "https://glyphs.geolonia.com/{fontstack}/{range}.pbf",
"sprite": "https://gsi-cyberjapan.github.io/optimal_bvmap/sprite/std",
"sources": {
"OSM_Raster": {
"type": "raster",
"tiles": ["https://tile.openstreetmap.jp/{z}/{x}/{y}.png"],
"tileSize": 256,
"attribution": "<a href=\"https://www.openstreetmap.org/copyright\">&copy; OpenStreetMap contributors</a>"
},
"OSM_Vector": {
"type": "vector",
"tiles": ["https://tile.openstreetmap.jp/data/planet/{z}/{x}/{y}.pbf"],
"minzoom": 14,
"maxzoom": 14,
"attribution": "<a href=\"https://www.openstreetmap.org/copyright\">&copy; OpenStreetMap contributors</a>"
}
},
"layers": [
{
"id": "OSM_Raster",
"type": "raster",
"source": "OSM_Raster",
"minzoom": 0,
"maxzoom": 24
},
{
"id": "OSM_POI",
"type": "circle",
"source": "OSM_Vector",
"source-layer": "poi",
"filter": ["has", "name"],
"layout": {
"visibility": "visible"
},
"paint": {
"circle-radius": 3.5,
"circle-color": "#00ffff",
"circle-opacity": 1.0
},
"minzoom": 17,
"maxzoom": 24
},
{
"id": "OSM_POI_Label",
"type": "symbol",
"source": "OSM_Vector",
"source-layer": "poi",
"filter": ["has", "name"],
"layout": {
"text-field": ["get", "name"],
"text-font": ["Noto Sans CJK JP Bold"],
"text-anchor": "left",
"text-offset": [0.5, 0],
"visibility": "visible"
},
"paint": {
"text-color": "rgba(255, 255, 255, 0.7)",
"text-halo-color": "rgba(0,0,0,0.7)",
"text-halo-width": 1.0
},
"minzoom": 17,
"maxzoom": 24
}
]
}

0 comments on commit 2cd7de2

Please sign in to comment.