Google maps 从属性表单显示位置的谷歌地图
我正在尝试制作一个显示属性的表单: 我的表格如下所示,我怎样才能让谷歌地图显示物业的位置Google maps 从属性表单显示位置的谷歌地图,google-maps,properties,Google Maps,Properties,我正在尝试制作一个显示属性的表单: 我的表格如下所示,我怎样才能让谷歌地图显示物业的位置 <legend><?php echo JText::_('COM_IPROPERTY_LOCATION'); ?></legend> <div class="formelm"><?php echo $this->form->getLabel('hide_address'); ?>
<legend><?php echo JText::_('COM_IPROPERTY_LOCATION'); ?></legend>
<div class="formelm"><?php echo $this->form->getLabel('hide_address'); ?>
<?php echo $this->form->getInput('hide_address'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('street_num'); ?>
<?php echo $this->form->getInput('street_num'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('street'); ?>
<?php echo $this->form->getInput('street'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('street2'); ?>
<?php echo $this->form->getInput('street2'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('apt'); ?>
<?php echo $this->form->getInput('apt'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('city'); ?>
<?php echo $this->form->getInput('city'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('postcode'); ?>
<?php echo $this->form->getInput('postcode'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('locstate'); ?>
<?php echo $this->form->getInput('locstate'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('province'); ?>
<?php echo $this->form->getInput('province'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('country'); ?>
<?php echo $this->form->getInput('country'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('region'); ?>
<?php echo $this->form->getInput('region'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('county'); ?>
<?php echo $this->form->getInput('county'); ?></div>
</fieldset>
<fieldset>
<legend><?php echo JText::_( 'COM_IPROPERTY_DRAG_AND_DROP' ); ?></legend>
<?php echo $this->form->getLabel('geocode_header'); ?>
<div class="formelm"><?php echo $this->form->getLabel('latitude'); ?>
<?php echo $this->form->getInput('latitude'); ?></div>
<div class="formelm"><?php echo $this->form->getLabel('longitude'); ?>
<?php echo $this->form->getInput('longitude'); ?></div>
<div><?php echo $this->form->getInput('google_map'); ?></div>
</fieldset>
</div>
创建一个谷歌地图并在上面添加一个标记。看起来您已经获得了纬度和经度,因此创建地图应该非常简单,如中所示。这应该是进一步开发地图的起点
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $this->form->getInput('latitude'); ?>,<?php echo $this->form->getInput('longitude'); ?>);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
函数初始化(){
var mylatng=newgoogle.maps.LatLng(,);
变量映射选项={
缩放:4,
中心:myLatlng,
mapTypeId:google.maps.mapTypeId.ROADMAP
}
var map=new google.maps.map(document.getElementById('map_canvas'),mapOptions);
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
标题:“你好,世界!”
});
}