查询地址和经纬度
This commit is contained in:
parent
bfdf00ce46
commit
a7715664d2
@ -7,7 +7,7 @@ import Guide from '../../components/Guide/index.ts';
|
||||
import icon2 from '../../assets/icon/position_icon2.png';
|
||||
import Header from '../../components/Header/index.js';
|
||||
|
||||
import { GaodeMap ,Scene, PointLayer, Heatmap, PolygonLayer } from '@antv/l7';
|
||||
import { GaodeMap ,Scene, PointLayer, Heatmap, PolygonLayer, Marker, MarkerLayer } from '@antv/l7';
|
||||
|
||||
import styles from './index.less';
|
||||
|
||||
@ -86,6 +86,7 @@ class BaseMap extends React.Component{
|
||||
|
||||
//根据cityname、adcode、citycode设置地图位置
|
||||
gotoCity = (data) => {
|
||||
this.state.map.removeAllMarkers();
|
||||
let zoom = data.zoom || 10;
|
||||
let lng = data.len || 116.405285;
|
||||
let lat = data.lat || 39.904989;
|
||||
@ -465,16 +466,14 @@ class BaseMap extends React.Component{
|
||||
if(this.state.inputExplainKey === 1){
|
||||
let location = this.state.inputContent
|
||||
let data = {
|
||||
'zoom': 13,
|
||||
'zoom': 8,
|
||||
'len': location.split(',')[0],
|
||||
'lat': location.split(',')[1],
|
||||
}
|
||||
this.gotoCity(data)
|
||||
let searchPointMarker = new AMap.Marker({
|
||||
icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
|
||||
position: [location.split(',')[0], location.split(',')[1]]
|
||||
});
|
||||
this.state.map.add(searchPointMarker);
|
||||
let icon = "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png";
|
||||
let searchPointMarker = new Marker().setLnglat({lng: location.split(',')[0], lat: location.split(',')[1]});
|
||||
this.state.map.addMarker(searchPointMarker);
|
||||
successSearchAddress();
|
||||
}else{
|
||||
let address = this.state.inputContent
|
||||
@ -493,16 +492,14 @@ class BaseMap extends React.Component{
|
||||
errorSearchAddress();
|
||||
}else{
|
||||
let data = {
|
||||
'zoom': 13,
|
||||
'zoom': 8,
|
||||
'len': coordinate.location.split(',')[0],
|
||||
'lat': coordinate.location.split(',')[1],
|
||||
}
|
||||
this.gotoCity(data)
|
||||
let searchPointMarker = new AMap.Marker({
|
||||
icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
|
||||
position: [coordinate.location.split(',')[0], coordinate.location.split(',')[1]]
|
||||
});
|
||||
this.state.map.add(searchPointMarker);
|
||||
let icon = "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png";
|
||||
let searchPointMarker = new Marker().setLnglat({lng: coordinate.location.split(',')[0], lat: coordinate.location.split(',')[1]});
|
||||
this.state.map.addMarker(searchPointMarker);
|
||||
successSearchAddress();
|
||||
}
|
||||
});
|
||||
@ -529,7 +526,7 @@ class BaseMap extends React.Component{
|
||||
<Col span={12}>
|
||||
<Input.Group compact style={{display:"inline",float:"right"}}>
|
||||
<label className={styles.labelForm}>查询:</label>
|
||||
<Select defaultValue="0" onChange={(e)=>{
|
||||
<Select defaultValue="0" style={{width: '80px'}} onChange={(e)=>{
|
||||
this.onSearchSwitch(e);
|
||||
}}>
|
||||
<Option value="0">地址</Option>
|
||||
|
Loading…
Reference in New Issue
Block a user