get coordinates of a marker symbol in mapbox-gl-js and center on it -


i have symbol on map

map.addlayer({     "id": "home",     "type": "symbol",     "source": "property",     "interactive": true,     "layout": {         "icon-image": "rocket-15",     } }); 

i zoom in marker , center on it.

so far have tried this:

map.featuresin({ layer: 'home' }, function(err, features) {     console.log(features);     map.flyto({ center: features[0].geometry.coordinates,zoom: 11 }); }); 

i omit coordinates argument, refer directly (as stated in api). however, 'features' arrive empty , can never fly

featuresin not return features' geometries default. that, must include includegeometry: true parameter.

you find this example helpful!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -