Javascript 使用React Api Google Map React基于半径过滤Google地图上的标记

Javascript 使用React Api Google Map React基于半径过滤Google地图上的标记,javascript,reactjs,google-map-react,Javascript,Reactjs,Google Map React,我正在尝试根据提供的半径显示标记-我无法为此开发逻辑。您的帮助将不胜感激,以下是显示标记数组的简单反应组件 我的问题是:我不知道如何使用radius属性,在哪里放置该属性,以及如何基于radius过滤标记 import React, { Component } from "react"; import { Button, Icon } from "semantic-ui-react"; import GoogleMapReact from "google-map-react"; const

我正在尝试根据提供的半径显示标记-我无法为此开发逻辑。您的帮助将不胜感激,以下是显示标记数组的简单反应组件

我的问题是:我不知道如何使用radius属性,在哪里放置该属性,以及如何基于radius过滤标记

import React, { Component } from "react";
import { Button, Icon } from "semantic-ui-react";
import GoogleMapReact from "google-map-react";

  const Marker = () => {
    return <Icon name="marker" size="big" color="red" />;
  };

   class TestComp extends Component {

     state = {
             radius:1000,  
             center: {
                      lat: 25.368899246383727,
                      lng: 68.36254264299168
                     },
             zoom: 11,
             markers: [
                     {
                      lat: 25.368899246383727,
                      lng: 68.36254264299168
                     },
                     {
                      lat: 25.37404182345329,
                      lng: 68.34019660949707
                      },
                      {
                       lat: 25.36947282956474,
                       lng: 68.35902661761315
                      },
                       {
                       lat: 25.374256533212648,
                       lng: 68.38060696313482
                        },
                        {
                       lat: 25.375484023750584,
                       lng: 68.33971454473567
                        }
                     ]
                 };


              render() {
                  const markersDisplay = this.state.markers.map(marker => (
                                  <Marker lat={marker.lat} lng={marker.lng} 
                                   />
                                  ));

                  return (
                       <div style={‌{ height: "200px", width: "100%" }}>
                       <GoogleMapReact
                            bootstrapURLKeys={‌{
                            key: "AIzaSyAO71fLtOUqY4pPwwP6q1eb-DAaxe7XwMM"
                            }}
                           defaultCenter={this.state.center}
                           defaultZoom={this.state.zoom}
                        >
                           {markersDisplay}
                       </GoogleMapReact>
                   </div>

                   );
                 }
                }

         export default TestComp;
import React,{Component}来自“React”;
从“语义ui反应”导入{按钮,图标};
从“谷歌地图反应”导入谷歌地图反应;
常量标记=()=>{
返回;
};
类TestComp扩展组件{
状态={
半径:1000,
中心:{
纬度:25.368899246383727,
液化天然气:68.36254269168
},
缩放:11,
标记:[
{
纬度:25.368899246383727,
液化天然气:68.36254269168
},
{
纬度:25.37404182345329,
液化天然气:68.34019660949707
},
{
纬度:25.36947282956474,
液化天然气:68.35902661761315
},
{
纬度:25.374256533212648,
液化天然气:68.38060696313482
},
{
纬度:25.375484023750584,
液化天然气:68.33971454473567
}
]
};
render(){
常量markersDisplay=this.state.markers.map(marker=>(
));
返回(
{markersDisplay}
);
}
}
导出默认TestComp;