kekscom / osmbuildings

OSM Buildings Classic 2.5D
http://osmbuildings.org
BSD 2-Clause "Simplified" License
505 stars 140 forks source link

size or zoom limit when rendering extruded GeoJson features #98

Closed marianobrc closed 8 years ago

marianobrc commented 8 years ago

Hi, first thanks for your effort, your framework is great.

I'm trying to use it to show some 3D Bars over a leaflet map. I'm defining the bars with GeoJson. I need to add a quite big object that can be seen even with a zoom level of 4. I've tried changing the parameter MIN_ZOOM to 3 and MAX_HEIGHT to 10000, and I can see the object at certain zoom level but anyway when i zoom out the object dissapear.

This is my code and the GeoJson:


        // 3D BIG box
    var geoJson3D = {
          "type": "FeatureCollection",
          "features": [{
            "type": "Feature",
            "id": 134,
            "geometry": {
              "type": "Polygon",
              "coordinates":  [
                  [
                    [
                      13.369331359863281,
                      52.50431055185085
                    ],
                    [
                      13.369331359863281,
                      52.526039219655445
                    ],
                    [
                      13.410873413085938,
                      52.526039219655445
                    ],
                    [
                      13.410873413085938,
                      52.50431055185085
                    ],
                    [
                      13.369331359863281,
                      52.50431055185085
                    ]
                  ]
                ]
            },
            "properties": {
              "wallColor": "rgb(255,0,0)",
              "roofColor": "rgb(255,128,0)",
              "height": 100,
              "minHeight": 0
            }
          }]
        };

var statesMap = new L.Map('states_map').setView([52.50440, 13.33522], 15);
baseLayer = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', {
            maxZoom: 25,
            attribution: 'Map data &copy; <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://mapbox.com">Mapbox</a>',
            id: 'mapbox.light'
        });
        baseLayer.addTo(statesMap);

 var osmbLayer = new OSMBuildings(statesMap).set(geoJson3D);

Thanks in advice, and thanks again for your work that is great.

kekscom commented 8 years ago

Without testing, I'd say increase CAM_Z instead of MAX_HEIGHT.