Skip to content

Commit

Permalink
add default postion
Browse files Browse the repository at this point in the history
  • Loading branch information
yoichigmf committed Feb 25, 2023
1 parent c40cfe4 commit 1f75068
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 31 deletions.
7 changes: 3 additions & 4 deletions appsscript.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"timeZone": "Etc/GMT-9",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"webapp": {
"executeAs": "USER_DEPLOYING",
"access": "ANYONE_ANONYMOUS"
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
}
82 changes: 63 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,21 @@
// 編集可能かどうか
var Editable = 0;

var UserID = "";
var XPOS = "";
var YPOS ="";
var ZOOM = "";



 if ( GasMode == 1 ){

UserID = <?=userid ?>;

XPOS = <?=XPOS ?>;
YPOS = <?=YPOS ?>;
ZOOM = <?=ZOOM ?>;


}

Expand Down Expand Up @@ -625,16 +638,19 @@
elem.className = classes.join(' ');
}

tstyle = 'https://raw.githubusercontent.com/gsi-cyberjapan/optimal_bvmap/main/style/skeleton.json'
tstyle = 'https://raw.githubusercontent.com/gsi-cyberjapan/optimal_bvmap/main/style/skeleton.json';

stdstyle = 'https://raw.githubusercontent.com/gsi-cyberjapan/gsivectortile-mapbox-gl-js/master/std.json';

stdstyle = 'https://raw.githubusercontent.com/gsi-cyberjapan/gsivectortile-mapbox-gl-js/master/std.json'
// center: [134.0188, 34.755387],
// zoom: 15,

var map = new maplibregl.Map({
container: 'map',
hash: true,
style: stdstyle , //style.jsonへのパス
center: [134.0188, 34.755387],
zoom: 15,
center: [XPOS,YPOS],
zoom: ZOOM,
maxZoom: 17.99,
minZoom: 4,
localIdeographFontFamily: false
Expand Down Expand Up @@ -885,12 +901,14 @@
//var lgp = document.getElementById("llist");
lgp.innerHTML = ihtml ;
console.log(ihtml);
SetDragScript(); // 動的に作成した要素に対するイベントは作成後に追加  ドラッグイベントを追加
//SetDragScript(); // 動的に作成した要素に対するイベントは作成後に追加  ドラッグイベントを追加




//console.log(JSON.stringify(RasterLayers));


var request = new XMLHttpRequest();
request.open("GET", GetFURL, true);
request.send();
Expand Down Expand Up @@ -927,18 +945,18 @@

// Spread Sheet中の調査ポイントを追加

gfeature["features"].forEach(function (feature) {
fkind = feature.properties['kind'];
gfeature["features"].forEach(function (feature) {
fkind = feature.properties['kind'];

ad = idTrans[fkind];
ad = idTrans[fkind];





feature.properties['icon'] = ad;
feature.properties['icon'] = ad;

});
});


map.addSource(
Expand Down Expand Up @@ -1360,11 +1378,11 @@
NewItem["geometry"] = geom;


gfeature["features"].push(NewItem);




map.getSource('rpoints').setData(gfeature);


//gfeature["features"][0]["geometry"]["coordinates"];

Expand All @@ -1384,9 +1402,9 @@
if ( GasMode == 1){
let tgSheet = "シート1";
google.script.run
.withSuccessHandler( successf )
.withSuccessHandler( successf(tgSheet, NewItem) )
.withFailureHandler( failf )
.addMessage( tgSheet, parseFloat(form.lat.value), parseFloat(form.lng.value), form.kind.value, form.stext.value );
.addMessage( tgSheet, parseFloat(form.lat.value), parseFloat(form.lng.value), form.kind.value, form.stext.value , UserID);


}
Expand All @@ -1400,22 +1418,48 @@
}

// GAS 登録成功
function successf( tgSheet ){
function successf( tgSheet, NewItem ){

gfeature["features"].push(NewItem);
 map.getSource('rpoints').setData(gfeature);
console.log("success");


  google.script.run
.withSuccessHandler( successGeoJSON )
.withFailureHandler( failf )
.withSuccessHandler(function(geoJ){

// if ( geoJ ){

let gjp = JSON.stringify( geoJ );
console.log(gjp);
// }
// else {
// console.log("NULL geoJ");
// }

console.log("geoJson success");

} )
.withFailureHandler( failf2 )
.GetFeaturesGeoJSON( tgSheet );


console.log("success");


}
function failf(){

alert("権限が無いのでデータ登録できません");
console.log("fail");

}

function failf2(){

// alert("権限が無いのでデータ登録できません");
console.log("fail geojson");

}

function successGeoJSON( tGeoJson ){

//alert( tGeoJson );
Expand Down
Loading

0 comments on commit 1f75068

Please sign in to comment.