如何在谷歌地图MVC 4上搜索位置

问题描述:

大家好,



我要做的是,我有数据库中的数据

例如

Hi all,

what am trying to do is, i have data in database
for example

Database table
Name       : Jack     
mob_number : 445452454             
address    : al saada street    
country    :  dubai





在我看来



@ item.Name

@ item.address

@ item.country



< script type =text / javascriptsrc =http:// maps.google.com/maps/api/js?sensor=false\"></script>



In my view

@item.Name
@item.address
@item.country

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

<script type="text/javascript">
                function initialize() {
                    var latlng = new google.maps.LatLng(40.716948, -74.003563);
                    var options = {
                        zoom: 14,
                        center: latlng,
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
                    var map = new google.maps.Map(document.getElementById("map"), options); 
                }

                initialize();
            </script>





问题是



#1)如何传递@ item.address到google地图搜索位置?



Problem is

#1) How to pass @item.address to google map for search location ?

请点击这些链接:



http://www.wikihow.com/Geocode-an-Address-in-Google-Maps-Javascript [ ^ ]



http://www.chautauquahomes。 us / wikihow / geocode / default.aspx [ ^ ]





执行:



http://www.ceat.com/locator.aspx [ ^ ]



点击检测位置按钮。



您需要将地址字符串传递给Gmaps才能获取地址。



请参阅JS部分中的函数codeAddress(addrString)。
Follow these links :

http://www.wikihow.com/Geocode-an-Address-in-Google-Maps-Javascript[^]

http://www.chautauquahomes.us/wikihow/geocode/default.aspx[^]


Implementation :

http://www.ceat.com/locator.aspx[^]

Click on "Detect Location" button.

You need to pass the address string to Gmaps to get the address.

Refer the function codeAddress(addrString) in JS section.