gistda-sphere-react

Circle

A circle around a center point, with area and radius measurement

import { Circle, SphereMap } from "gistda-sphere-react";

<SphereMap center={{ lon: 100.5018, lat: 13.7563 }} style={{ height: 400 }} zoom={10}>
  <Circle
    center={{ lon: 100.5018, lat: 13.7563 }}
    radius={0.1}
    fillColor="rgba(0, 128, 255, 0.3)"
    lineColor="blue"
    lineWidth={2}
    title="Coverage area"
  />
</SphereMap>

Props

PropTypeDescription
centerLocationRequired. Center of the circle.
radiusnumberRequired. Radius in degrees. One degree is about 111 km, so 0.01 is roughly 1.1 km.

Circles also take the shape props.

To size a circle in meters, divide by the length of one degree: radius={meters / 111_320}.

Ref

MethodDescription
getCircle()The underlying sphere.Circle.
getCenter()Center of the circle.
getRadius(language?)Radius in meters, or text such as "5.48 km" with a language.
getArea(language?)Area in square meters, or text such as "94.3 sq.km" with a language.
getBound, contains, intersects, within, distanceTo, rotate, shift, updateStyle, togglePopup, toGeoJSONAs for polygons.

On this page