Leaflet SVG pattern 1
Filling path with pattern on leaflet SVG-overlay doesn't work.
Filled background shows up transparent in Firefox and black in Chrome.
Based on leaflet GeoJSON Example: http://leafletjs.com/examples/geojson.html
see workaround: http://jsfiddle.net/vkrw2/
HTML
<script src="http://leafletjs.com/examples/sample-geojson.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css">
<div id="map" style="width: 600px; height: 400px"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
JavaScript
var map = L.map('map').setView([39.74739, -105], 13);
L.tileLayer('http://{s}.tile.cloudmade.com/{key}/22677/256/{z}/{x}/{y}.png', {
attribution: 'Map data © 2011 OpenStreetMap contributors, Imagery © 2012 CloudMade',
key: 'BC9A493B41014CAABB98F0471D759707'
}).addTo(map);
function onEachFeature(feature, layer) {
var popupContent = "<p>I started out as a GeoJSON " +
feature.geometry.type + ", but now I'm a Leaflet vector!</p>";
if (feature.properties && feature.properties.popupContent) {
popupContent += feature.properties.popupContent;
}
layer.bindPopup(popupContent);
}
L.geoJson([bicycleRental, campus], {
style: function (feature) {
return feature.properties && feature.properties.style;
},
onEachFeature: onEachFeature,
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
radius: 8,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
});
}
}).addTo(map);
L.geoJson(freeBus, {
filter: function (feature, layer) {
if (feature.properties) {
// If the property "underConstruction" exists and is true, return false (don't render features under construction)
return feature.properties.underConstruction !== undefined ? !feature.properties.underConstruction : true;
}
return false;
},
onEachFeature: onEachFeature
}).addTo(map);
$(function() {
$('.leaflet-zoom-animated').prepend('<defs><pattern id="diagonalHatch" patternUnits="userSpaceOnUse" x="0" y="0" width="105" height="105"><g style="fill:none; stroke:black; stroke-width:1"><path d="M0 90 l15,15"/><path d="M0 75 l30,30"/><path d="M0 60 l45,45"/><path d="M0 45 l60,60"/><path d="M0 30 l75,75"/><path d="M0 15 l90,90"/><path d="M0 0 l105,105"/><path d="M15 0 l90,90"/><path d="M30 0 l75,75"/><path d="M45 0 l60,60"/><path...