我认为问题出在训练数据中,正如您在下面看到的那样,我放了 php 代码和渲染来解释。
我是谷歌地图 API 的新手,这不是我的代码。那么问题来了:什么时候放大这个指针在我放大时移动了很多!我无法弄清楚地图显示的冲突。我只想使用 LatLong 来指示该区域,但提供了脚本来计算道路..这是第二个假设。
我尝试了什么:
- 从:
setMapAddress ("<? Php city ();?>, <? Php been ();?>, <? Php zipcode ();?>");
- 到
setMapAddress ("");
- 结果:
setMapAddress (" , , ");
- 删除:
bed: "<?php beds(); ?>",
bath: "<?php baths(); ?>",
size: "<?php echo get_post_meta($post->ID, "_ct_sqft", true); ?> <?php sqftsqm(); ?>",
street: "<?php the_title(); ?>",
city: "<?php city(); ?>",
state: "<?php state(); ?>",
zip: "<?php zipcode(); ?>",
问题图片:
<script>
function setMapAddress(address) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { address : address }, function( results, status ) {
if( status == google.maps.GeocoderStatus.OK ) {
<?php if((get_post_meta(get_the_ID(), "_ct_latlng", true))) { ?>
var location = new google.maps.LatLng(<?php echo get_post_meta(get_the_ID(), "_ct_latlng", true); ?>);
<?php } else { ?>
var location = results[0].geometry.location;
<?php } ?>
var options = {
zoom: 15,
center: location,
mapTypeId: google.maps.MapTypeId.<?php echo strtoupper($ct_options['ct_contact_map_type']); ?>,
streetViewControl: true
};
var mymap = new google.maps.Map( document.getElementById( 'map' ), options );
var marker = new MarkerWithLabel({
map: mymap,
draggable: false,
flat: true,
labelContent: '',
labelAnchor: new google.maps.Point(22, 0),
labelClass: "label", // the CSS class for the label
labelStyle: {opacity: 1},
icon: '<?php echo get_template_directory_uri(); ?>/images/blank.png',
<?php if((get_post_meta(get_the_ID(), "_ct_latlng", true))) { ?>
position: new google.maps.LatLng(<?php echo get_post_meta(get_the_ID(), "_ct_latlng", true); ?>)
<?php } else { ?>
position: results[0].geometry.location
<?php } ?>
});
}
});
}
setMapAddress( "<?php city(); ?>, <?php state(); ?>, <?php zipcode(); ?>" );
</script>
<div id="map"></div>
此代码呈现为:
<script>
function setMapAddress(address) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { address : address }, function( results, status ) {
if( status == google.maps.GeocoderStatus.OK ) {
var location = new google.maps.LatLng(42.608120,14.067420);
var options = {
zoom: 15,
center: location,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: true
};
var mymap = new google.maps.Map( document.getElementById( 'map' ), options );
var marker = new MarkerWithLabel({
map: mymap,
draggable: false,
flat: true,
labelContent: '',
labelAnchor: new google.maps.Point(22, 0),
labelClass: "label", // the CSS class for the label
labelStyle: {opacity: 1},
icon: 'http://pineto.contat.eu/wp-content/themes/th/images/blank.png',
position: new google.maps.LatLng(42.608120,14.067420)
});
}
});
}
setMapAddress( ", , " );
</script>