Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on buildings #212

Open
cmarfil opened this issue May 1, 2017 · 0 comments
Open

Click on buildings #212

cmarfil opened this issue May 1, 2017 · 0 comments

Comments

@cmarfil
Copy link

cmarfil commented May 1, 2017

Hello,

Is it possible to get information building on user click?
And for example, change the color to make a selection effect?

// Buildings and roads from Mapzen (polygons and linestrings)
    var topoJSONTileLayer = VIZI.topoJSONTileLayer('https://vector.mapzen.com/osm/buildings,roads/{z}/{x}/{y}.topojson?api_key=vector-tiles-NT5Emiw', {
        interactive: true,
        style: function(feature) {
            var height;

            if (feature.properties.height) {
                height = feature.properties.height;
            } else {
                height = 10 + Math.random() * 10;
            }

            return {
                height: height,
                lineColor: '#f7c616',
                lineWidth: 1,
                lineTransparent: true,
                lineOpacity: 0.2,
                lineBlending: THREE.AdditiveBlending,
                lineRenderOrder: 2
            };
        },
        filter: function(feature) {
            // Don't show points
            return feature.geometry.type !== 'Point';
        },
        onEachFeature: function(feature, layer) {
            layer.on('click', function(layer, point2d, point3d, intersects) {
                //Get INFO of building?

                console.log('feature',feature);
                console.log('layer',layer);
                console.log('point2d',point2d);
                console.log('point3d',point3d);
                console.log('intersects',intersects);
            });
        }
    }).addTo(world);

On click, I am not able to get any information from the building and I can not access the individual styles of that building.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant