Google-map-react: [question] How to load & display KML

Created on 28 Aug 2016  路  3Comments  路  Source: google-map-react/google-map-react

I have a KML layer of GPS tracks that I want to load and display on the map, how do I do it the React way with this?

I was able to get it working, but I had to use onGoogleApiLoaded

This is what I did:

onAPILoad({ map, maps }){
    var KML = new maps.KmlLayer({
        url: 'PATH_TO_KML'
    });
    KML.setMap(map);
}

render(){
    return <GoogleMap {...props} onGoogleApiLoaded={this.onAPILoad} />;
}

Is there a proper way to use getMapOptions? I couldn't find anywhere in the docs/examples. If there isn't is this a valid feature request?

All 3 comments

Sorry I have no idea about what is KML and why do you need getMapOptions ;-)
Please see the sources to find the answer you need.

@istarkov I would also love to see support for KML files. KML is a layer file, which is used when you export maps from the Google MyMaps UI. This would allow users to easily create maps using the Google MyMaps UI, export them, and import them into their Google-Maps-React project.
Please let me know if there is any possibility of this happening since my current project somewhat depends on it.

I'm not using this library now in any of my work projects, so I'm not interested and have no time to somehow extend this library. I even have no time to support it well.
May be in a future (but having that mapbox solutions beats google in every case I feel that such future will never come)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kirylkliushkin picture kirylkliushkin  路  4Comments

StephenMayeux picture StephenMayeux  路  4Comments

nhducit picture nhducit  路  5Comments

nguyenthithao picture nguyenthithao  路  4Comments

Pau1fitz picture Pau1fitz  路  4Comments