dongtie0929 2013-03-02 16:03
浏览 25
已采纳

缩放标记,但......它正在移动! O.O到底是什么

I think the problem is in the training data, as you can see below there I put the php code and the rendering to explain.

I'm new to API to Google Maps, this is not my code. Then comes the problem: when to once zoom in on this pointer moves a lot when i zooming! I can not figure out what the conflict of maps displaying. I'd like to use only LatLong to indicate the area but the script is provided to calculate the road .. this is the second hypothesis.

What I tried:

  • From: setMapAddress ("<? Php city ();?>, <? Php been ();?>, <? Php zipcode ();?>");
  • To setMapAddress ("");
  • Result: setMapAddress (" , , ");

-deleting:

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(); ?>",

Image of issue: #[Image of issue][1]


Page with script

<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>

This code was rendered as:

<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>
  • 写回答

1条回答 默认 最新

  • dongqianzhan8325 2013-03-02 17:27
    关注

    The problem was with the image.

    First get rid of the following css (layout.css, line 151):

    font-weight: bold; color: #fff; padding: 1px 4px; background: url(<?php echo get_template_directory_uri(); ?>/images/map-pin.png) no-repeat;} 
    

    Then, make sure this javascript (mapping.js, line 26):

    icon: 'wp-content/themes/reale/images/blank.png',

    points to my marker image.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)