谷歌地图网址 [英] google map url

查看:92
本文介绍了谷歌地图网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

实际上,我将整个地址检索到文本框(即街道,城市,州).我想将此地址传递给Google地图,以便如何将整个地址传递给URL.

我将用该代码修改什么

hello

actually i retrieve the whole address to text box(ie.street,city,state).i want to pass this address to the Google map so how can i make that whole address to URL.

what will i modify with that code

Response.Redirect("http://www.google.com/maps??hl=en&q=" + TextBox1.Text.ToString() + "");



上面的代码只获得第一个单词,意味着(街道)的地址不是全部.



the above code get only the 1st word means (street) not all the address.

推荐答案

您可以将空格替换为空一个
You can Replace the Space with Empty one
string Custname = txtCustName.Text.Replace(" ", "").ToString();


尝试这个想法

在地址和街道之间使用诸如(!,|)之类的字符,然后

将此字符替换为"(上面的代码).
Try this idea

using some charactors like (! , |) between the address and street then

replace this charactos to "" (the above code).


如果您的问题是您的TextBox是多行,那么只有第一行传递给Google查询字符串,那么您需要做的是将所有换行符和回车符替换为适当的内容,以使它作为一行文本出现.例子:
If your problem is that your TextBox is multiple lines, so that only the first line gets passed to the Google query string, then what you need to do is replace any line feeds and carriage returns with something appropriate so that it comes out as a single line of text. An example:
Response.Redirect("http://www.google.com/maps??hl=en&q=" + TextBox1.Text.ToString().Replace(Environment.NewLine, ", ")) + "");


在此示例中,我用逗号和空格替换了回车和/或换行符.

但是,如果您希望查询格式正确适用于Google:
此处 [ ^ ]是有关Google地图查询及其所有参数的良好参考.


In this example I replaced the the carriage return and/or the line feed with a comma and space.

However, if you are looking to get your query formatted right for Google:
Here[^] is a good reference regarding the Google map query and all of its parameters.


这篇关于谷歌地图网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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