javascript - 如何在谷歌地图上更改圆半径的颜色
问题描述
我想把半径圆放在谷歌地图上。我已经检查了谷歌地图 api 文档,但仍然不知道该怎么做。
这是我的代码:
const MyMapComponent = compose(
withProps({
googleMapURL: googleMapsApiKey,
loadingElement: <div style={mapConfigStyle.loadingElement} />,
containerElement: <div style={mapConfigStyle.containerElement} />,
mapElement: <div style={mapConfigStyle.mapElement} />
}),
withScriptjs,
withGoogleMap,
)(props => (
<GoogleMap
defaultZoom={12}
defaultCenter={{ lat: Number(this.state.latitude), lng: Number(this.state.longitude) }}
>
<Circle
radius={1900}
fillColor="#2a5777"
center={{ lat: Number(this.state.latitude), lng: Number(this.state.longitude) }}
/>
{props.isMarkerShown && (
<Marker position={{ lat: Number(this.state.latitude), lng: Number(this.state.longitude) }} options={{ icon: { url: '/boost_marker.png' } }} />
)}
</GoogleMap>
解决方案
这对我有用
const options = {
fillColor: color,
strokeColor: color,
strokeOpacity: 0.8,
strokeWeight: 0.1,
fillOpacity: 0.35,
clickable: false,
draggable: false,
editable: false,
visible: true,
zIndex: 1
}
<Circle
key={id}
radius={1000}
center={{
lat: latitude,
lng: longitude
}}
options={options}
/>
推荐阅读
- python - 当我的变量是整个列表而不仅仅是整数时使用 for 循环(python)
- python - 在列表的每个节点上存储列表列表
- sql - 如何添加两个不同查询的结果?
- terminal - 如何在 UTOP 中设置制表符空间键绑定
- python-2.7 - 如何使用用户输入 MGRS 坐标通过 arcpy 创建 Shapfile
- vue.js - 如何将数据传递给链接元素的键和链接?
- rust - Reqwest 的 Client.post() 为 File.io API 返回 400 错误请求
- python - 重试python请求模块挂起
- c# - 我可以在 HttpModule 中使用 Db 上下文吗?
- c++ - 通过 move_pages() 查询失败