React-google-maps: Example or Doc for Rectangle or Polygons properties

Created on 11 May 2017  路  7Comments  路  Source: tomchentw/react-google-maps

Are there any example using the shape components (Rectangle, Polygons)? Ive looked through the docs and didnt find any docs explaining what is need to use it properly.
onClick={_.noop}
onRightClick={_.noop}
onDragStart={_.noop}
/>
This is what is see on the main page but doesnt really explain how to specify where the lat/long goes and how to use it.

Most helpful comment

I think its something like this

      import { Polygon } from 'react-google-maps';

      <Polygon
        paths={[points]}
        options={{
          fillColor: `red`,
          fillOpacity: 0.20,
          strokeColor: `red`,
          strokeOpacity: 1,
          strokeWeight: 1,
        }}
      />

All 7 comments

I think its something like this

      import { Polygon } from 'react-google-maps';

      <Polygon
        paths={[points]}
        options={{
          fillColor: `red`,
          fillOpacity: 0.20,
          strokeColor: `red`,
          strokeOpacity: 1,
          strokeWeight: 1,
        }}
      />

How do you detect if a marker point is inside the polygon? For example, https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation

It doesn't look like this library has that method. could also use something like https://github.com/manuelbieh/Geolib isPointInside - depends on what you need it for

The goal is to have the user be able to click or view if a new set of lat/lng are in the current polygon area. Similar to the example for google if you clicked inside the bermudaTriangle you would see a blue triangle and outside a red circle.

Please refer to Getting Help section in the README.

Hi @whosGuys, did you finally find out how to do this ? I have the same issue. Nothing about that in the Getting Help section by the way. Something like containsLocation() would be amazing !

@glevha No unfortunately after reviewing the licensing of this library, we had to switch to something else so i never did figure out this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timkraut picture timkraut  路  3Comments

tahir-masood1 picture tahir-masood1  路  4Comments

craigcartmell picture craigcartmell  路  4Comments

LukasZvikas picture LukasZvikas  路  3Comments

manoj150283 picture manoj150283  路  3Comments