安卓天安卓腾讯地图开发发

您的位置: &
人气:12099
大小:18MB
授权:免费软件
语言:简体中文
系统要求:Android 2.2 以上
管理手机内容
免费下载资源
全面支持 Android 手机
天地图手机地图是一套由天地图有限公司自主研发,针对目前主流的Android操作系统开发的基于智能手机、平板电脑等移动设备的免费地图应用软件,拥有国内面向公众服务*权威、*完整的海量地理空间数据,为用户提供完备的地图功能。目前推出的主要功能包括:矢量地图浏览、卫星影像地图浏览、多方式实时定位、查找兴趣点等。天地图手机地图拥有国内*庞大的地理信息数据库:1)覆盖范围广而细,从全球、宏观中国全境到具体县市、乡镇、村庄,立足为我国老百姓提供全面拒绝访问 | www.ggdoc.com | 百度云加速
请打开cookies.
此网站 (www.ggdoc.com) 的管理员禁止了您的访问。原因是您的访问包含了非浏览器特征(42fb43ab-ua98).
重新安装浏览器,或使用别的浏览器acgis for Android加载天地图
package com.hvit.
import android.app.A
import android.os.B
import com.esri.android.map.MapV
import com.esri.android.map.event.OnZoomL
public class TianDiTuActivity extends Activity {
MapView mMapV
TianDiTuTiledMapServiceLayer t_//天地图矢量图
TianDiTuTiledMapServiceLayer t_//天地图矢量标注
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
= (MapView) findViewById(R.id.map_mapView);//创建mapView对象
t_vec = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.VEC_C);//创建天地图对象
mMapView.addLayer(t_vec);//将矢量的天地图对象加载到地图图层
t_cva = new TianDiTuTiledMapServiceLayer(TianDiTuTiledMapServiceType.CVA_C);//创建标注
mMapView.addLayer(t_cva);//添加标注
mMapView.setOnZoomListener(new OnZoomListener() {
protected void onDestroy() {
super.onDestroy();
protected void onPause() {
super.onPause();
mMapView.pause();
protected void onResume() {
super.onResume();
mMapView.unpause();天地图开发之Android-天地图显示
最近开始学Android地图开发,由于做天地图api的人不多,想把自己这一段时间的劳动成果分享给大家,顺便可以一起学习。我用的版本是天地图移动API(Android)V2.1版。
1.下载天地图移动API库
要在Android应用中使用天地图API,就需要在工程中引用百度地图API开发包,下载地址, 下载
2.第一个天地图map应用
第一步:在工程里新建libs文件夹,开发包里的tiandituapi2.1.jar拷贝到libs根目录下,将libMapEngine.so拷贝到libs\armeabi目录下(官网demo里已有这两个文件,如果要集成到自己的工程里,就需要自己添加),拷贝完成后的工程目录如下图所示;
第二步:在工程属性-&Java Build Path-&Libraries中选择“AddExternal JARs”,选定tiandituapi2.1.jar,确定后返回,这样您就可以在您的程序中使用API了。
a、添加所需权限
&uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"&
&/uses-permission&
&uses-permission android:name="android.permission.ACCESS_WIFI_STATE"&
&/uses-permission&
&uses-permission android:name="android.permission.INTERNET"&
&/uses-permission&
&uses-permission android:name="android.permission.CALL_PHONE"&
&/uses-permission&
&uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"&
&/uses-permission&
&uses-permission android:name="android.permission.READ_PHONE_STATE"&
&/uses-permission&
&uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"&
&/uses-permission&
b、在布局xml文件中添加地图显示组件,并把布局文件选到Activity中显示。
&com.tianditu.android.maps.MapView
android:id="@+id/main_mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/&
c、在Activity中初始化地图 在Activity的onCreate()接口中添加以下代码:
MapView mMapView = (MapView) findViewById(R.id.bmapsView);
//设置启用内置的缩放控件
mMapView.setBuiltInZoomControls(true);
//得到mMapView的控制权,可以用它控制和驱动平移和缩放
MapController mMapController = mMapView.getController();
//用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6)
GeoPoint point = new GeoPoint((int) (39.915 * 1E6), (int) (116.404 * 1E6));
//设置地图中心点
mMapController.setCenter(point);
//设置地图zoom级别
mMapController.setZoom(12);
好了,完成。其实天地图开发指南上对了这个解释的也极其清楚~~~~
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!以推广空间分析和空间数据挖掘为己任,致力于在GIS界传递分析价值,
安卓智能地图开发与实施十三:空间查询与展示 - ArcGIS Runtime SDK for Android(Version 100.0.0)
空间查询与展示
空间查询需要入口(屏幕触摸、文字输入,甚至绘制个Geometry进行查询),也需要展示容器,如果查询仅仅返回一条记录,在地图中弹出窗口展示信息足矣。当返回多条记录,特别是多个图层的多条记录便需要类似AnimatedExpandableListView的容器来放置查询结果。
查询效果(脖子不好时):
源程序请自行下载:
链接: 密码:uh2d
若失效,可发邮件给韩源萌()索要。
后面的都是废话(代码解释)
空间查询的入口可以是个按钮,找一个类似ArcMap中的Identify图标的图片作为菜单的icon 即可。SearchView是Android原生的搜索框控件,它提供了一个用户界面,用于用户搜索查询。
main_activity_header_menu.xml
&?xml version="1.0" encoding="utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"&
android:id="@+id/action_identify"
android:orderInCategory="50"
android:title="空间查询"
app:showAsAction="always"
android:icon="@drawable/ic_action_search_identity"/&
android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:orderInCategory="50"
android:title="属性搜索"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always"/&
处理空间查询
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_identify) {
mainConfigurations.ChangeMapViewOnTouchFunction(Configurations.MapTouchType.TOTALIDENTIFY);
return true;
return super.onOptionsItemSelected(item);
处理文本查询
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_activity_header_menu, menu);
MenuItem menuItemSearch = menu.findItem(R.id.action_search);
mainSearchView = (SearchView) MenuItemCompat.getActionView(menuItemSearch);
mainSearchView.setQueryHint("查找...");
mainSearchView.setSubmitButtonEnabled(false);
mainSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
public boolean onQueryTextSubmit(String query) {
final MapQueryClass mapQueryClass = new MapQueryClass();
mapQueryClass.Search(mainConfigurations.getMainReadOperationsFL(),
new IQueryResult() {
public void getQuery() {
List&MapQueryClass.MapQueryResult& mapQueryResults= mapQueryClass.getMapQueryResult();
for (MapQueryClass.MapQueryResult mapQueryResult:mapQueryResults
mapQueryResult.labelField =
mainConfigurations.GetLayerLabelFieldName(mapQueryResult.featureLayer.getName());
mainSearchView.onActionViewCollapsed();
mainSearchView.clearFocus();
ShowSearchResultFunction(mapQueryResults);
return false;
public boolean onQueryTextChange(String newText) {
return false;
MenuItem menuItemidentify = menu.findItem(R.id.action_identify);
return true;
MapView的触摸事件
MapView的setOnTouchListener没有对应的移除机制。
public void ChangeMapViewOnTouchFunction(MapTouchType type) {
ChangeMapViewOnTouchFunction(type, null);
public void ChangeMapViewOnTouchFunction(MapTouchType type, FeatureLayer featureLayer) {
if (mainCallout.isShowing()) {
mainCallout.dismiss();
switch (type) {
case SKETCH:
mainSketchGraphicsOverlay.mCanMapTouch = true;
canLayerTouchidentity = false;
canMapTouchidentity = false;
case LAYERIDENTIFY:
mainSketchGraphicsOverlay.mCanMapTouch = false;
canLayerTouchidentity = true;
canMapTouchidentity = false;
StartLayerTouchFunction(featureLayer);
case TOTALIDENTIFY:
mainSketchGraphicsOverlay.mCanMapTouch = false;
canLayerTouchidentity = false;
canMapTouchidentity = true;
StartMapTouchFunction();
case CLEAR:
mainSketchGraphicsOverlay.mCanMapTouch = false;
canLayerTouchidentity = false;
canMapTouchidentity = false;
这里的代码处理的比较乱,合适的方式是定义一个枚举的变量,没必要弄这么多Boolean。
StartLayerTouchFunction
protected void StartLayerTouchFunction(FeatureLayer featureLayer) {
if(featureLayer == null)
ClearLayerFunction();
final FeatureLayer mainFeatureLayer = featureL
mainMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mainMapView) {
public boolean onSingleTapConfirmed(MotionEvent e) {
if (canLayerTouchidentity == false) {
return super.onSingleTapConfirmed(e);
android.graphics.Point screenPoint = new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY()));
final Point clickPoint = MapViewMethodsClass.GetMapPointFromScreenPointFunction(mainMapView,screenPoint);
Envelope mapEnvelope = MapViewMethodsClass.GetEnvelopeFromMapPointFunction(
mainMapView,screenPoint,10);
final MapQueryClass mapQueryClass = new MapQueryClass();
mapQueryClass.Select(
mainFeatureLayer,
mapEnvelope,
new IQueryResult() {
public void getQuery() {
List&MapQueryClass.MapQueryResult& mapQueryResults= mapQueryClass.getMapQueryResult();
for (MapQueryClass.MapQueryResult mapQueryResult:mapQueryResults
mapQueryResult.labelField =
GetLayerLabelFieldName(mapQueryResult.featureLayer.getName());
HymnActivity.mainHymnActivity.ShowSearchResultFunction(mapQueryResults);
return super.onSingleTapConfirmed(e);
StartMapTouchFunction
protected void StartMapTouchFunction(){
mainMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this,mainMapView) {
public boolean onSingleTapConfirmed(MotionEvent e) {
if (canMapTouchidentity == false) {
return super.onSingleTapConfirmed(e);
ClearLayerFunction();
android.graphics.Point screenPoint =
new android.graphics.Point(Math.round(e.getX()), Math.round(e.getY()));
Envelope mapEnvelope =
MapViewMethodsClass.GetEnvelopeFromMapPointFunction(mainMapView,screenPoint,10);
final MapQueryClass mapQueryClass = new MapQueryClass();
mapQueryClass.Select(
mainReadOperationsFL,
mapEnvelope,
new IQueryResult() {
public void getQuery() {
List&MapQueryClass.MapQueryResult& mapQueryResults= mapQueryClass.getMapQueryResult();
for (MapQueryClass.MapQueryResult mapQueryResult:mapQueryResults
mapQueryResult.labelField =
GetLayerLabelFieldName(mapQueryResult.featureLayer.getName());
HymnActivity.mainHymnActivity.ShowSearchResultFunction(mapQueryResults);
return super.onSingleTapConfirmed(e);
ShowMapCallOutFunction
public void ShowMapCallOutFunction(Feature feature){
TextView calloutContent = new TextView(getApplicationContext())
calloutContent.setTextColor(Color.BLACK)
calloutContent.setSingleLine(false)
calloutContent.setVerticalScrollBarEnabled(true)
calloutContent.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET)
calloutContent.setMovementMethod(new ScrollingMovementMethod())
calloutContent.setMaxWidth(600)
calloutContent.setLines(5)
calloutContent.setText(
AttributeMethodsClass.GetCalloutStringByAttributeFunction(
feature.getAttributes()))
mainCallout.setLocation(GeometryMethodsClass.GetFeatureCenterFunction(feature))
mainCallout.setContent(calloutContent)
mainCallout.show()
查询结果的承载 - AnimatedExpandableListView
对AnimatedExpandableListView感兴趣的可参考
main_search_result_group_item.xml
&?xml version="1.0" encoding="utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:paddingLeft="40dp"&
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:id="@+id/resultGroupContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="0dp"
android:layout_marginLeft="0dp"
app:layout_constraintLeft_toLeftOf="parent" /&
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="10"
android:id="@+id/resultGroupCountContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="0dp"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent" /&
main_search_result_list_item.xml
&?xml version="1.0" encoding="utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:paddingLeft="50dp"&
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:id="@+id/resultListContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&
SearchResultAdapter.java
package esrichina.hymn.usingmappingbyhymnlocal.A
import android.content.C
import android.view.LayoutI
import android.view.V
import android.view.ViewG
import android.widget.TextV
import com.esri.arcgisruntime.data.F
import com.esri.arcgisruntime.layers.FeatureL
import java.util.ArrayL
import java.util.L
import esrichina.hymn.ListView.AnimatedExpandableListV
import esrichina.hymn.MapQuery.MapQueryC
import esrichina.hymn.usingmappingbyhymnlocal.R;
* Created by HymnHan on .
public class SearchResultAdapter extends AnimatedExpandableListView.AnimatedExpandableListAdapter {
private LayoutI
private List&MapQueryClass.MapQueryResult& items = new ArrayList&&();
public SearchResultAdapter(Context context) {
inflater = LayoutInflater.from(context);
public void setData(List&MapQueryClass.MapQueryResult& items) {
this.items =
public Feature getChild(int groupPosition, int childPosition) {
return items.get(groupPosition).features.get(childPosition);
public long getChildId(int groupPosition, int childPosition) {
return childP
public View getRealChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
MapQueryClass.MapQueryResult mapQueryResult = getGroup(groupPosition);
if (convertView == null) {
holder = new ChildHolder();
convertView = inflater.inflate(R.layout.main_search_result_list_item, parent, false);
holder.title = (TextView) convertView.findViewById(R.id.resultListContainer);
convertView.setTag(holder);
holder = (ChildHolder) convertView.getTag();
holder.title.setText(mapQueryResult.getTitle(childPosition));
holder.mapQueryResult = mapQueryR
return convertV
public int getRealChildrenCount(int groupPosition) {
return items.get(groupPosition).features.size();
public MapQueryClass.MapQueryResult getGroup(int groupPosition) {
return items.get(groupPosition);
public int getGroupCount() {
return items.size();
public long getGroupId(int groupPosition) {
return groupP
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
MapQueryClass.MapQueryResult mapQueryResult = getGroup(groupPosition);
if (convertView == null) {
holder = new GroupHolder();
convertView = inflater.inflate(R.layout.main_search_result_group_item, parent, false);
holder.title = (TextView) convertView.findViewById(R.id.resultGroupContainer);
holder.count = (TextView) convertView.findViewById(R.id.resultGroupCountContainer);
convertView.setTag(holder);
holder = (GroupHolder) convertView.getTag();
holder.title.setText(mapQueryResult.getLayerTitle());
holder.count.setText("共 " + String.valueOf(mapQueryResult.getFeatureCount()) + " 条");
holder.mapQueryResult = mapQueryR
return convertV
public boolean hasStableIds() {
return true;
public boolean isChildSelectable(int arg0, int arg1) {
return true;
public static class ChildHolder {
public TextV
public MapQueryClass.MapQueryResult mapQueryR
public static class GroupHolder {
public TextV
public TextV
public MapQueryClass.MapQueryResult mapQueryR
SearchResultComponent.java
package esrichina.hymn.usingmappingbyhymnlocal.C
import android.view.V
import android.widget.ExpandableListV
import com.esri.arcgisruntime.data.F
import java.util.ArrayL
import java.util.L
import esrichina.hymn.ListView.AnimatedExpandableListV
import esrichina.hymn.MapQuery.MapQueryC
import esrichina.hymn.Methods.MapViewMethodsC
import esrichina.hymn.usingmappingbyhymnlocal.Adapters.SearchResultA
import esrichina.hymn.usingmappingbyhymnlocal.R;
* Created by HymnHan on .
public class SearchResultComponent extends BaseComponent {
private AnimatedExpandableListView searchResultC
private SearchResultAdapter searchResultA
public SearchResultComponent() {
searchResultAdapter = new SearchResultAdapter(mainHymnActivity);
searchResultContainer = (AnimatedExpandableListView) mainHymnActivity.findViewById(R.id.searchResultContainer);
searchResultContainer.setAdapter(searchResultAdapter);
searchResultContainer.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
SearchResultAdapter.ChildHolder childHolder =
(SearchResultAdapter.ChildHolder) v.getTag();
Feature feature = childHolder.mapQueryResult.features.get(childPosition);
MapViewMethodsClass.CenterMapViewByGeometryFunction(
mainHymnActivity.getMainMapView(),
childHolder.mapQueryResult.selectFeature(feature);
mainConfigurations.ShowMapCallOutFunction(feature);
return false;
public void ClearSearchResultFunction()
searchResultAdapter.setData(new ArrayList&MapQueryClass.MapQueryResult&());
searchResultAdapter.notifyDataSetChanged();
public void ShowSearchResultFunction(List&MapQueryClass.MapQueryResult& mapQueryResults)
searchResultAdapter.setData(mapQueryResults);
searchResultAdapter.notifyDataSetChanged();
searchResultContainer.expandGroupWithAnimation(0);
查询结果的承载 - SlidingUpPanelLayout
对SlidingUpPanelLayout感兴趣的可参考
&esrichina.hymn.DragUpPanel.SlidingUpPanelLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainSliding"
android:gravity="bottom"
app:umanoPanelHeight="20dp"
app:umanoShadowHeight="4dp"
app:umanoParallaxOffset="100dp"
app:umanoDragView="@+id/dragView"
app:umanoOverlay="false"
app:umanoScrollableView="@+id/searchResultContainer"
app:umanoAnchorPoint="0.565"
app:umanoFadeColor="@color/geometry_swatch_background"
app:umanoInitialState="hidden"&
&android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"&
&include layout="@layout/main_map_container"/&
&include layout="@layout/main_activity_header_container"/&
&/android.support.design.widget.CoordinatorLayout&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical"
android:clickable="true"
android:focusable="false"
android:id="@+id/dragView"&
&LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_panel_header"
android:orientation="horizontal"
android:background="@color/bootstrap_brand_info"&
&/LinearLayout&
&include layout="@layout/main_search_result_container"/&
&/LinearLayout&
&/esrichina.hymn.DragUpPanel.SlidingUpPanelLayout&
查询结果的清除
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!

我要回帖

更多关于 安卓 室内地图开发 的文章

 

随机推荐