1
0
Fork 0

algo con mapero

This commit is contained in:
julianalytica 2017-06-24 17:04:40 -05:00
parent 1cf217e95c
commit 737a92d9f1
1 changed files with 78 additions and 5 deletions

View File

@ -56,7 +56,56 @@ $plantilla ="mapa";
<script src="librerias/leaflet/dist/leaflet.markercluster-src.js"></script>
<script type="text/javascript" src="milfs/geojson.js.php?id=<?php echo $_REQUEST['id'] ?>&buscar=<?php echo $_REQUEST['buscar'] ?>"></script>
<!-- <script type="text/javascript" src="http://localhost/default/tupali/milfs/geojson.js.php?id=358"></script> -->
<!-- <script type="text/javascript" src="tmp/ruta_paz_territorial.geojson"></script> -->
<?php
$otro_json = remplacetas('form_parametrizacion','campo',$_REQUEST[id],'descripcion'," tabla='form_id' and opcion = 'json'") ;;
//$obj = file_get_contents('https://www.kleper.net/wiki/RutaPazTerritorial.geojson');
$ids = json_decode($otro_json[0]);
foreach ($ids as $clave => $valor) {
if($valor !=""){
$obj=file_get_contents("$valor[0]");
$li .="<script>var geojsonAuxiliar_$clave = $obj ;</script>";
$layer .= "
var geojsonAux_$clave = L.geoJson(geojsonAuxiliar_$clave, {
pointToLayer: function(feature, latlng) {
var smallIcon = new L.Icon({
iconSize: [60, 60],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
/*iconUrl: feature.properties.icon.iconUrl*/
iconUrl: 'https://tupale.co/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png'
});
return L.marker(latlng, {icon: smallIcon});
},
onEachFeature: function(feature, layer) {
var popupText = feature.properties.description
layer.bindPopup(popupText); }
});
";
$add_layer .= "markers.addLayer(geojsonAux_$clave);";
$capas_nombre .="geojsonAux_$clave,";
$capas .= "{
'$clave': geojsonAux_$clave
};";
$overlays ="
var overlays = $capas ";
}
}
//$obj=file_get_contents("$otro_json[0]");
//echo "<script>var geojsonAuxiliar = $obj ;</script>";
echo $li;
?>
<style type="text/css">
@media (max-width: 800px) {
@ -280,7 +329,7 @@ $leyenda ="<div id='div_leyenda'><a class='btn btn-default btn-xs' onclick=xaja
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '&copy; <a href="https://openstretmap.org/copyright">OpenStreetMap</a> contributors'
attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}),
latlng = L.latLng(4, -74.9005222);
@ -295,6 +344,7 @@ $leyenda ="<div id='div_leyenda'><a class='btn btn-default btn-xs' onclick=xaja
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: feature.properties.icon.iconUrl
/* iconUrl: "http://localhost/default/tupali/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png"*/
});
return L.marker(latlng, {icon: smallIcon});
@ -307,24 +357,47 @@ onEachFeature: function(feature, layer) {
layer.bindPopup(popupText); }
});
/*
var geojsonAux = L.geoJson(geojsonAuxiliar, {
pointToLayer: function(feature, latlng) {
var smallIcon = new L.Icon({
iconSize: [60, 60],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: "http://localhost/default/tupali/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png"
});
return L.marker(latlng, {icon: smallIcon});
},
onEachFeature: function(feature, layer) {
var popupText = feature.properties.description
layer.bindPopup(popupText); }
});
*/
<?php echo $layer; ?>
var markers = L.markerClusterGroup();
markers.addLayer(geojson);
// markers.addLayer(geojsonAux);
<?php echo $add_layer; ?>
map.fitBounds(geojson.getBounds());
var legend = L.control({position: 'bottomright'});
//disable zoomControl when initializing map (which is topleft by default)
///L.control.layers(<?php echo $capas_nombre; ?>).addTo(map);
//add zoom control with your options
/* //add zoom control with your options
L.control.zoom({
position:'topright'
}).addTo(map);
*/
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend');
div.innerHTML = "";