question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't get polygons to show on the map

See original GitHub issue

Hello,

I am struggling to get polygons to show on the map. I am pretty sure I am missing something simple - tried a lot of things and looked at the examples in the repo, but can’t figure it out. Could you give me a hand with this one?

import React, { Component } from 'react';
import { Map, GoogleApiWrapper, Polygon } from 'google-maps-react';

export class MapContainer extends Component {
  render() {
    const coords = [
      { lat: 52.490235, lng:  13.314174 },
      { lat: 52.494076, lng:  13.325    },
      { lat: 52.494487, lng:  13.326395 },
      { lat: 52.49484,  lng:  13.328369 },
      { lat: 52.495114, lng:  13.331158 },
      { lat: 52.487249, lng:  13.331201 },
      { lat: 52.486393, lng:  13.326759 },
      { lat: 52.486374, lng:  13.322661 },
      { lat: 52.486348, lng:  13.320011 },
      { lat: 52.487733, lng:  13.318069 },
      { lat: 52.488948, lng:  13.315902 }
    ]

    return (
      <Map
        google={this.props.google}
        style={{width: '100%', height: '100%', position: 'relative'}}
        zoom={13}
        initialCenter={{lat:  52.5201377, lng: 13.4050336}}
        clickableIcons={false}
        className={'map'}
      >
          <Polygon
            paths={[coords]}
            strokeColor="#0000FF"
            strokeOpacity={0.8}
            strokeWeight={2}
            fillColor="#0000FF"
            fillOpacity={0.35} />
      </Map>
    );
  }
}

export default GoogleApiWrapper({
  apiKey: ("API_KEY"),
  version: '3'
})(MapContainer)

Thanks a lot!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thomaPaulcommented, Dec 4, 2017

Same Problem, the given example in the documentation is not working for me as well.

0reactions
blainegarrettcommented, Dec 14, 2017

I made a PR: https://github.com/fullstackreact/google-maps-react/pull/143

This is my first contrib to OSS libs so be nice please 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix: Polygons not showing on the map - Fusion Tables Help
Zoom the map in. Polygons are not shown at zoom levels 5 and below due because the complexity may not be representable within...
Read more >
Problem: Unable to display polygon and point feature services ...
In ArcGIS Online, open the web map containing the polygon or point feature services and save each of them in the web map...
Read more >
Polygons not showing in android google maps / a work around..
Can't see your polygon layers in Android google maps - well.. I have created a work around that is straight forward, I trawled...
Read more >
Google MyMaps doesn't show polygons properly
1 Answer 1 · Find our broken polygon (Ctrl+F) enter image description here · If you find your broken polygon, you can compare...
Read more >
Create polygon features—ArcGIS Pro | Documentation
Confirm that the feature layer you are editing is editable, the coordinate system assigned to the active map is suitable for the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found