「Widget:Custom map」の版間の差分
提供:メタファー リファンタジオ 攻略Wiki
ヘイグ運営用アカウント (トーク | 投稿記録) 編集の要約なし |
ヘイグ運営用アカウント (トーク | 投稿記録) 編集の要約なし |
||
221行目: | 221行目: | ||
console.log('Debug tools loaded. Type debugLoadPins() to start debugging or showLoadPinsHelp() for instructions.'); | console.log('Debug tools loaded. Type debugLoadPins() to start debugging or showLoadPinsHelp() for instructions.'); | ||
////////// | |||
// GeoJSONデータの詳細な検証関数 | |||
window.debugGeoJSONFeatures = function() { | |||
const geojsonPage = "<!--{$geojson}-->"; | |||
getMwToken() | |||
.then(function(token) { | |||
return $.ajax({ | |||
type: "GET", | |||
url: API_BASE_URL + '/api.php', | |||
data: { | |||
action: 'query', | |||
titles: geojsonPage, | |||
prop: 'revisions', | |||
rvprop: 'content', | |||
format: 'json' | |||
}, | |||
headers: { | |||
'Authorization': 'Bearer ' + token | |||
} | |||
}); | |||
}) | |||
.then(function(response) { | |||
const pages = response.query.pages; | |||
const pageId = Object.keys(pages)[0]; | |||
const content = pages[pageId].revisions[0]['*']; | |||
const geoJSON = JSON.parse(content); | |||
console.group('=== Detailed GeoJSON Analysis ==='); | |||
geoJSON.features.forEach((feature, index) => { | |||
console.group(`Feature ${index + 1}`); | |||
console.log('Raw coordinates:', feature.geometry.coordinates); | |||
console.log('Properties:', { | |||
title: feature.properties.title, | |||
content: feature.properties.content, | |||
iconType: feature.properties.iconType, | |||
tags: feature.properties.tags | |||
}); | |||
// 座標値の検証 | |||
const [lng, lat] = feature.geometry.coordinates; | |||
console.log('Coordinate validation:', { | |||
longitude: lng, | |||
latitude: lat, | |||
isValid: !isNaN(lng) && !isNaN(lat) && | |||
lng >= 0 && lng <= imageBase.width && | |||
lat >= 0 && lat <= imageBase.height | |||
}); | |||
// ポップアップコンテンツの検証 | |||
const popupContent = `<strong>${feature.properties.title}</strong><br>${feature.properties.content}`; | |||
console.log('Popup content preview:', popupContent.substring(0, 100)); | |||
console.groupEnd(); | |||
}); | |||
console.groupEnd(); | |||
}) | |||
.catch(console.error); | |||
}; | |||
// マーカー位置のデバッグ用ヘルパー関数 | |||
window.validateMarkerPositions = function() { | |||
console.group('=== Marker Position Validation ==='); | |||
console.log('Image bounds:', imageBounds); | |||
drawnItems.eachLayer(layer => { | |||
if (layer instanceof L.Marker) { | |||
const pos = layer.getLatLng(); | |||
console.log('Marker position:', { | |||
lat: pos.lat, | |||
lng: pos.lng, | |||
isWithinBounds: imageBounds.contains(pos), | |||
distanceFromEdges: { | |||
top: pos.lat - imageBounds.getNorth(), | |||
bottom: imageBounds.getSouth() - pos.lat, | |||
left: pos.lng - imageBounds.getWest(), | |||
right: imageBounds.getEast() - pos.lng | |||
} | |||
}); | |||
} | |||
}); | |||
console.groupEnd(); | |||
}; | |||
////////////////////////////////////////////// | |||
window.savePopupContent = savePopupContent; | window.savePopupContent = savePopupContent; |