从街景使用图片 [英] Using image from street view
问题描述
我想街景(说明经度和纬度),并显示在对话框中的图片,这可能吗?
I want to get a picture of streetview (stating latitude and longitude) and display in a dialog, is this possible?
我看到一些例子在这里,但没有找到一个教我如何在对话框中显示的图像。
I saw some examples here, but not found one that show me how to display the image in dialog.
很抱歉,如果已经存在于网站的这个问题,但我没有发现,当我搜索。
Sorry if already exists this question in the site, but I not found when I search.
推荐答案
当然可以,
作为URL根,你可以使用这个 http://cbk0.google.com/ 或< A HREF =http://maps.google.com相对=nofollow> maps.google.com
as a URL root you can use this one http://cbk0.google.com/ or maps.google.com
和这是你提供的位置使用上面提到的网址一个例子:
and this is a example where you use above mentioned URL by providing location:
的http://cbk0.google.com/cbk?output=xml&hl=x-local&ll=34.058593,-118.240673&it=all
结果应该是:
<panorama>
<data_properties image_width="13312" image_height="6656" tile_width="512" tile_height="512" pano_id="70o9Pukc2KSjO-PfeHussw" scene="1" imagery_type="2" level_id="ffffffffb3840000" num_zoom_levels="5" lat="34.058620" lng="-118.240693" original_lat="34.058620" original_lng="-118.240693" best_view_direction_deg="109.819">
<copyright>© 2013 Google</copyright>
<text/>
<street_range/>
<region/>
<country/>
</data_properties>
<projection_properties projection_type="spherical" pano_yaw_deg="93.25" tilt_yaw_deg="-180" tilt_pitch_deg="0"/>
<annotation_properties>
<link yaw_deg="252.58" pano_id="qciD6ogWmkxiq4p3OaprjA" road_argb="0x80fdf872" scene="1">
<link_text/>
</link>
<link yaw_deg="38.52" pano_id="lqiWuIrIXa_86In3RRxB1w" road_argb="0x80fdf872" scene="1">
<link_text/>
</link>
</annotation_properties>
<levels>
<level level_id="ffffffffb3840000" pano_id="70o9Pukc2KSjO-PfeHussw" ordinal="0">
<text/>
<abbreviation/>
</level>
</levels>
</panorama>
从XML你获取 pano_id
,(在我的情况 pano_id =70o9Pukc2KSjO-PfeHussw
)
和之后,你可以根据提取图像 pano_id
:
and after you can extract image based on pano_id
:
<一个href="http://cbk0.google.com/cbk?output=tile&panoid=70o9Pukc2KSjO-PfeHussw&zoom=3&x=5&y=1" rel="nofollow">http://cbk0.google.com/cbk?output=tile&panoid=70o9Pukc2KSjO-PfeHussw&zoom=3&x=5&y=1
其他的方式从中获取XML maps.google.com
:
Other way to get XML from maps.google.com
:
http://maps.google.com/cbk?output= XML和放大器; LL = 32.051626,34.7613
从URL加载图像,有很多选择:
to load Image from URL, there is a lot options:
绘制对象的
public static Drawable LoadImageFromWebOperations(String url) {
try {
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
} catch (Exception e) {
return null;
}
}
或位图的:
try {
ImageView i = (ImageView)findViewById(R.id.image);
Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageUrl).getContent());
i.setImageBitmap(bitmap);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
希望它会帮助你,
Hope it will help you,
这篇关于从街景使用图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!