Joac Joac - 1 year ago 72
Javascript Question

Geodesic Lines on GeoJSON features on google maps

Im writing a GeoJson layer for Google Maps that uses different kinds of Features, styled dynamically.

I cant find a way to plot

as geodesic lines.

I have to make a feature request for Google Maps API or I'm missing something?

Answer Source

It's not implemented(currently), but it would be a desirable feature.

A workaround would be to hide the feature and create a custom polyline instead:'addfeature', function(e) {
        //when it's a Line
          //hide the feature
, {visible: false});
          //add a polyline
          new google.maps.Polyline({path    : e.feature.getGeometry().getArray(),
                                    map     : this.getMap(),
                                    geodesic: true});

It's a simple example, of course you also need to apply the styles & event-handlers