是否可以从传单中导出geojson以保存地图状态?
我想存储标记,缩放和地图中心以在以后加载。
有很多方法可以在传单上加载geojson,但我不知道有任何方法可以将地图导出到geojson ...
当我从浏览器中获取Google Maps Geocoding API时,它正在运行,但不是来自我的PHP脚本.
工作:https://maps.google.com/maps/api/geocode/json?appens = false&key = AzazaSyDqIj_SXTf5Z5DgE_cvn5VF9h5NbuaiCbs&address = La%20P%C3%A9relle,%20Saint-Pierre-de-Chartreuse,%20France
退货:
{
"results" : [
{
"address_components" : [
{
"long_name" : "La Pérelle",
"short_name" : "La Pérelle",
"types" : [ "colloquial_area", "political" ]
},
],
"formatted_address" : "La Pérelle, 38380, France",
// other stuffs
"partial_match" : true,
"place_id" : "ChIJZzDRRAX4ikcRnZ-vb1tnTgY",
"types" : [ "colloquial_area", "political" ]
}
],
"status" : "OK"
}
Run Code Online (Sandbox Code Playgroud)
不工作:
<?php
$url = 'https://maps.google.com/maps/api/geocode/json?sensor=false&key=AIzaSyDqIj_SXTf5Z5DgE_cvn5VF9h5NbuaiCbs&address=La%20P%C3%A9relle,%20Saint-Pierre-de-Chartreuse,%20France';
echo file_get_contents($url);
Run Code Online (Sandbox Code Playgroud)
返回:
{
"results" : …Run Code Online (Sandbox Code Playgroud) 我有一张带有 的传单地图LineString。
// a GeoJSON LineString
var geojson = {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [[-101.123, 40.2500], [-101.123, 40.2503]]
}
};
// create map and add json
var map = L.map('map');
var geojsonLayer = new L.GeoJSON(geojson).addTo(map);
map.fitBounds(geojsonLayer.getBounds())
// add popup for the line
geojsonLayer.eachLayer(function (layer) {
var popup = L.popup();
popup.setContent('text');
layer.bindPopup(popup);
layer.on('click mouseover', function () {
layer.openPopup();
});
});
Run Code Online (Sandbox Code Playgroud)
当我越过它时,LineString 中心会打开一个弹出窗口。
如何让它在光标位置打开?
这是一个简单的工作示例:http ://jsfiddle.net/wuu8Lv2t/1/
对于聊天应用程序,我想知道我的离子内容是否在底部滚动,仅在用户已经在底部时才添加消息后再次向下滚动.
是否可以轻松检测内容何时滚动?