google maps - I can not use feature.get Geometry () in a MultiLineString -


i'm plotting geojson on map using google maps api v3. point of layers functioning normally. have multilinestring camda , center map on geometry gives error.this occurs polygon, points works well. there other way centralize multilinestring , polygons?

  google.maps.event.addlistener(cicloviaslayer, 'addfeature', function (e) {      console.log(e.feature.getgeometry().gettype()); // multilinestring ok!      map.setcenter(e.feature.getgeometry().get());    });   

erro:

e.feature.getgeometry(...).get not function 

the data.multilinestring class doesn't have get method, has getat , getarray methods.

getat(n:number)

return value: data.linestring

returns n-th contained data.linestring.

the returned linestring has getat method returns google.maps.latlng object

getat(n:number)

return value: latlng

returns n-th contained latlng.

google.maps.event.addlistener(cicloviaslayer, 'addfeature', function (e) {   console.log(e.feature.getgeometry().gettype()); // multilinestring ok!   // center map on first vertex of first linestring   map.setcenter(e.feature.getgeometry().getat(0).getat(0)); });   

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -