से अतिरिक्त जानकारी के साथ पत्रक पॉपअप एक समस्या है। मैं geojson से एक पुस्तिका पुस्तिका में पॉपअप के लिए अतिरिक्त जानकारी बांधना चाहता हूँ। पुस्तिका दस्तावेज से कुछ चीजें देखी लेकिन यह काम नहीं करता है।GeoJSON
var map = L.map('map').setView([51.9, 7.6], 11);
L.tileLayer('http://{s}.tile.cloudmade.com/5e4495ff4b0d454eb0443225198b7e6c/997/256/{z}/{x}/{y}.png', {
attribution:
'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 16
}).addTo(map);
var polygon = {
"type": "Feature",
"properties": {
"name":"City BoundingBox",
"style": {
"color": "#004070",
"weight": 4,
"opacity": 1
}
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[7.5,52.05],
[7.7,51.92],
[7.6,51.84],
[7.4,51.94],
[7.5,52.05]
]]
}
};
var myLayer = L.geoJson().addTo(map);
//myLayer.addData(polygon);
var popup = L.popup();
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
<?php
$mdjson = file_get_contents("http://xxx/ows?service=WFS&version=1.0.0&outputFormat=JSON&request=GetFeature&typeName=xx:yy&maxFeatures=50");
echo "var geojsonMD = ".$mdjson.";";
?>
myLayer.addData(geojsonMD);
L.geoJson(geojsonMD, {
style: function (feature) {
return {color: feature.properties.color};
},
onEachFeature: function (feature, myLayer) {
layer.bindPopup(feature.properties.description);
}
}).addTo(map);
आशा है कि आप मेरी मदद कर सकते हैं।
सर्वश्रेष्ठ संबंध।
आप इसे थोड़ा स्पष्ट है कि आप क्या करना चाहते हैं कर सकते हैं? क्या आप अपनी बनाई गई बहुभुज के साथ सेवा से geoJson donwloaded गठबंधन करना चाहते हैं? – flup