Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using Leaflet L.Polygon, but for some reason there's only blank site. Here's my code:

    var map = L.map('map').setView([37.8, -96], 4);

    var cloudmade = L.tileLayer('http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', {
                attribution: 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
                key: 'BC9A493B41014CAABB98F0471D759707',
                styleId: 22677
            }).addTo(map);


  var alabama = new L.polygon([
                [-87.359296,35.00118],[-85.606675,34.984749],[-85.431413,34.124869],[-85.184951,32.859696],[-85.069935,32.580372],[-84.960397,32.421541],[-85.004212,32.322956],[-84.889196,32.262709],[-85.058981,32.13674],[-85.053504,32.01077],[-85.141136,31.840985],[-85.042551,31.539753],[-85.113751,31.27686],[-85.004212,31.003013],[-85.497137,30.997536],[-87.600282,30.997536],[-87.633143,30.86609],[-87.408589,30.674397],[-87.446927,30.510088],[-87.37025,30.427934],[-87.518128,30.280057],[-87.655051,30.247195],[-87.90699,30.411504],[-87.934375,30.657966],[-88.011052,30.685351],[-88.10416,30.499135],[-88.137022,30.318396],[-88.394438,30.367688],[-88.471115,31.895754],[-88.241084,33.796253],[-88.098683,34.891641],[-88.202745,34.995703],[-87.359296,35.00118]
            ]).addTo(map).bindPopup("Alabama");

UPDATE


I found out what is wrong. These coordinates are in geojson format (lngs lat). But Leaflet polygon coordinates should be in lat lngs.

share|improve this question
    
Can you try adding another set of [] around the Multipolygon? –  BradHards Jan 4 '13 at 5:11
    
I found out what is wrong. –  againstflow Jan 4 '13 at 14:42
    
Can you add this as the answer, and mark it as answered? –  BradHards Jan 4 '13 at 21:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.