我以前也有过类似的问题。我所做的是创建一个具有[unique key id]的表和另一个列markerJson,
var marker = new L.Marker([0, 0]);
// Get the GeoJSON object
var geojson = marker.toGeoJSON();
它有以下几点
{
"type":"Feature",
**"properties":{},**
"geometry":{
"type":"Point",
"coordinates":[0,0]
}
}
将上面的json保存在上面创建的markerjson列中。
从数据库获取并将[unique key id]附加到属性“properties”:{}例如
“properties”:{unique-key\u id:28},现在用户可以从properties访问唯一id。