Tag: google maps api 3

如何通过C#将图像从URL添加到Excel工作表

这是目标: 1)从URL获取图像,在这种情况下,Google静态地图API 2)将此图像插入到Excel工作表中。 如果我必须创build(或使用现有的)形状并将背景设置为图像,那我可以。 我也可以插入特定的单元格。 我可以通过Google静态地图API(请参阅上面的URL)定义图片大小,以便始终知道。 我没有完全清楚如何做到这一点,而不是直接将文件保存到文件系统。 我目前有这样的代码获取图像的MemoryStream格式: public static MemoryStream GetStaticMapMemoryStream(string requestUrl, string strFileLocation) { try { HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) throw new Exception(String.Format( "Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription)); using (BinaryReader reader = new BinaryReader(response.GetResponseStream())) { Byte[] lnByte […]

Google Maps API两点之间的距离返回不同的路线

在Excel中,使用VB来计算两点之间的距离。 当我这样做时,我似乎无法得到两点之间的多条路线的距离。 当我调用函数GetDistance(“Alabama”,“Georgia”)时,它给出了从Alabama到Georgia的一条路线的距离,显然在Google Maps上它们是从A点到B点的多条路线,距离不同。 当我使用MsgBox objHTTP.responseText来显示所有的路由距离时,它只显示一个路由距离,如截图所示。 我怎样才能显示所有的路线英里距离? 'Calculate Google Maps distance between two addresses Public Function GetDistance(start As String, dest As String, unit As Integer) Dim firstVal As String, secondVal As String, lastVal As String firstVal = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=" secondVal = "&destinations=" lastVal = "&mode=car&language=pl&sensor=true&units=Imperical" Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") URL = firstVal & Replace(start, " ", […]

如何将Google Map结果列表导入Excel?

我正在尝试从Google地图获取我当地餐馆的列表。 我可以使用Google地球将结果保存在KML中,并将其重命名为XML以便导入Excel。 我想用Google Maps API代替。 我尝试使用Google Maps API连接到Microsoft PowerBI并使用以下Web连接器方法: https ://maps.googleapis.com/maps/api/place/nearbysearch/json?location=54.77614759999999,-1.5605721&radius =2000& type=restaurant&key = INSERT_API_KEY 但是,这是一个“地点search”,并没有带来任何细节,如网站或电话号码等。为了包括“细节search”,我必须使用本主题中提到的JavaScript函数: Google Places API -放置详细信息请求undefined 有没有什么办法可以使用这个上面的JavaScript在Excel中生成一个列表? 我可以使用VBA到Web API来实现这个function吗? https://www.youtube.com/watch?v=u9IPJ8KKp_A 我有PowerBI和Visual Studio,但不习惯JavaScript。 任何帮助非常感谢,谢谢。 亲切的问候, Tanim