[Spanish] cartoDB-leaflet
xesco
xescobm at gmail.com
Fri Jun 14 04:44:09 PDT 2013
Hola a todos,
Tengo una duda con Leaflet. Verésis quiero añadir una capa de CartoDB como
overlay de acuerdo al tutorial
http://leafletjs.com/examples/layers-control.html y configurar el popup como
en http://cartodb.github.io/cartodb.js/examples/TheHobbitLocations/, pero el
siguiente código no me funciona:
var natura = new L.cartoDB("http://xesco.cartodb.com/api/v2/sql?q=SELECT *
FROM patrimoni WHERE categoria='Natura'", {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconSize: [25, 25],
iconAnchor: [13, 25],
popupAnchor: [1, -24],
iconUrl:
'http://www.gisig.it/smespire2/wp-content/uploads/2011/09/green.png'
})
})
},
onEachFeature: function(vis, layer) {
// Set the custom infowindow template defined on the html
layer.infowindow.set('template', $('#infowindow_template').html());
// add the tooltip show when hover on the point
vis.addOverlay({
type: 'tooltip',
template: '<p>{{patrimoni}}</p>'
});
vis.addOverlay({
type: 'infobox',
template: '
{{patrimoni}}
<p>{{entitat}}</p>',
width: 200,
position: 'bottom|right'
});
}
}),
window.onload = main,
monument = new L.cartoDB("http://xesco.cartodb.com/api/v2/sql?q=SELECT *
FROM patrimoni WHERE categoria='Monument'", {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconSize: [25, 25],
iconAnchor: [13, 25],
popupAnchor: [1, -24],
iconUrl: 'http://www.gisig.it/smespire2/wp-content/uploads/2011/09/red.png'
})
})
},
onEachFeature: function(vis, layer) {
// Set the custom infowindow template defined on the html
layer.infowindow.set('template', $('#infowindow_template').html());
// add the tooltip show when hover on the point
vis.addOverlay({
type: 'tooltip',
template: '<p>{{patrimoni}}</p>'
});
vis.addOverlay({
type: 'infobox',
template: '
{{patrimoni}}
<p>{{entitat}}</p>',
width: 200,
position: 'bottom|right'
});
}
}),
window.onload = main,
cultura = new L.cartoDB("http://xesco.cartodb.com/api/v2/sql?q=SELECT * FROM
patrimoni WHERE categoria='Cultura'", {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {
icon: L.icon({
iconSize: [25, 25],
iconAnchor: [13, 25],
popupAnchor: [1, -24],
iconUrl: 'http://www.gisig.it/smespire2/wp-content/uploads/2011/09/blue.png'
})
})
},
onEachFeature: function(vis, layer) {
// Set the custom infowindow template defined on the html
layer.infowindow.set('template', $('#infowindow_template').html());
// add the tooltip show when hover on the point
vis.addOverlay({
type: 'tooltip',
template: '<p>{{patrimoni}}</p>'
});
vis.addOverlay({
type: 'infobox',
template: '
{{patrimoni}}
<p>{{entitat}}</p>',
width: 200,
position: 'bottom|right'
});
}
}),
window.onload = main;
var patrimoni= L.layerGroup([natura, monument, cultura]);
Por supuesto que está lleno de errores, por eso mismo escribo. ¿Se os ocurre
cualquier cosa?
Muchas gracias de antemano.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/cartoDB-leaflet-tp5060174.html
Sent from the OSGeo Spanish Local Chapter mailing list archive at Nabble.com.
More information about the Spanish
mailing list