如何在谷歌地图MVC 4上搜索位置 [英] How to search location on google map MVC 4

查看:97
本文介绍了如何在谷歌地图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.


这篇关于如何在谷歌地图MVC 4上搜索位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆