Ejemplo n.º 1
0
        /// <summary>
        /// 围栏搜素
        /// </summary>
        /// <param name="table_id">表id,即表的唯一标识(table_id在表创建后由系统自动生成,可在地点云数据管理台查询得到)</param>
        /// <param name="key">开发者key</param>
        /// <param name="secretKey">开发者密钥</param>
        /// <param name="location">搜索中心点坐标</param>
        /// <param name="keyword">搜索关键字</param>
        /// <param name="filter">按字段值筛选,支持设置为可搜索的自定义number型字段及预设可搜索的系统字段(详见数据定义)</param>
        /// <param name="orderby">排序方式</param>
        /// <param name="fields">指定返回字段:返回文本数据大小对性能影响较大,建议只获取需要的字段</param>
        /// <param name="page_size">每页条数:默认10条,最大支持200条</param>
        /// <param name="page_index">页码,默认第1页</param>
        /// <param name="output">返回格式:支持json(默认)及jsonp</param>
        /// <param name="callback">JSONP方式回调函数</param>
        /// <returns></returns>
        public static MapResponse <CloudSearchData> SearchContain(string table_id,
                                                                  string key,
                                                                  string secretKey,
                                                                  string location,
                                                                  string keyword  = null,
                                                                  string filter   = null,
                                                                  string orderby  = null,
                                                                  string fields   = null,
                                                                  int page_size   = 10,
                                                                  int page_index  = 1,
                                                                  string output   = null,
                                                                  string callback = null)
        {
            string query = GetRequestBuilder.Create(secretKey, "/place_cloud/search/contain")
                           .WithKeyValue("key", key)
                           .WithKeyValue("table_id", table_id)
                           .WithKeyValue("location", location)
                           .WithKeyValue("keyword", keyword)
                           .WithKeyValue("filter", filter)
                           .WithKeyValue("orderby", orderby)
                           .WithKeyValue("fields", fields)
                           .WithKeyValue("page_size", page_size.ToString())
                           .WithKeyValue("page_index", page_index.ToString())
                           .WithKeyValue("output", output)
                           .WithKeyValue("callback", callback)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <CloudSearchData> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取所有数据li
        /// </summary>
        /// <param name="table_id"></param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <param name="fields"></param>
        /// <param name="orderby"></param>
        /// <param name="page_size"></param>
        /// <param name="page_index"></param>
        /// <param name="output"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public static MapResponse <CloudSearchData> Search(string table_id,
                                                           string key,
                                                           string secretKey,
                                                           string fields   = null,
                                                           string orderby  = null,
                                                           int?page_size   = 10,
                                                           int?page_index  = null,
                                                           int?page_next   = null,
                                                           string output   = null,
                                                           string callback = null)
        {
            string query = GetRequestBuilder.Create(secretKey, "/place_cloud/data/list")
                           .WithKeyValue("key", key)
                           .WithKeyValue("table_id", table_id)
                           .WithKeyValue("fields", fields)
                           .WithKeyValue("orderby", orderby)
                           .WithKeyValue("page_size", page_size)
                           .WithKeyValue("page_index", page_index)
                           .WithKeyValue("page_next", page_next)
                           .WithKeyValue("output", output)
                           .WithKeyValue("callback", callback)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <CloudSearchData> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取所有省市区列表
        /// </summary>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static AreaResponse <List <List <Area> > > GetAreas(string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/district/v1/list")
                           .WithKeyValue("key", key)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <AreaResponse <List <List <Area> > > >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 地址解析
        /// </summary>
        /// <param name="address">地址(注:地址中请包含城市名称,否则会影响解析效果) address=北京市海淀区彩和坊路海淀西大街74号</param>
        /// <param name="region">地址所在城市(若地址中包含城市名称侧可不传)     region=北京</param>
        /// <param name="key">开发密钥(Key)</param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static MapResponse <AddressToLocationResponse> AddressToLocation(string address, string region, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/geocoder/v1")
                           .WithKeyValue("address", address)
                           .WithKeyValue("region", region)
                           .WithKeyValue("key", key)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <AddressToLocationResponse> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///   实现从其它地图供应商坐标系或标准GPS坐标系,批量转换到腾讯地图坐标系。
        /// </summary>
        /// <param name="locations">
        /// 预转换的坐标,支持批量转换,
        /// 格式:纬度前,经度后,纬度和经度之间用",“分隔,每组坐标之间使用”;"分隔;
        /// 批量支持坐标个数以HTTP GET方法请求上限为准
        /// locations=39.12,116.83;30.21,115.43
        /// </param>
        /// <param name="type">
        /// 输入的locations的坐标类型
        /// 可选值为[1, 6] 之间的整数,每个数字代表的类型说明:
        /// 1 GPS坐标
        /// 2 sogou经纬度
        /// 3 baidu经纬度
        /// 4 mapbar经纬度
        /// 5 [默认] 腾讯、google、高德坐标
        /// 6 sogou墨卡托
        /// </param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static LocationTranslateResponse LocationTranslate(string locations, int type, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/coord/v1/translate")
                           .WithKeyValue("key", key)
                           .WithKeyValue("locations", locations)
                           .WithKeyValue("type", type.ToString())
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <LocationTranslateResponse>(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 查询表结构
        /// </summary>
        /// <param name="table_id"></param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <param name="output"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public static MapResponse <TableCollection> QueryStructure(string table_id, string key, string secretKey, string output = "json", string callback = null)
        {
            string query = GetRequestBuilder.Create(secretKey, "/place_cloud/table/list")
                           .WithKeyValue("key", key)
                           .WithKeyValue("table_id", table_id)
                           .WithKeyValue("output", output)
                           .WithKeyValue("callback", callback)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <TableCollection> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 逆地址解析【坐标转地址】
        /// </summary>
        /// <param name="location">经纬度(GCJ02坐标系),格式:location=lat<纬度>,lng<经度>  示例:location = 39.984154,116.307490</param>
        /// <param name="get_poi">是否返回周边地点(POI)列表,可选值:0 不返回(默认)1 返回</param>
        /// <param name="poi_options"></param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static MapLocationToAddressResponse <LocationToAddress> LocationToAddress(string location, int get_poi, string poi_options, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/geocoder/v1")
                           .WithKeyValue("location", location)
                           .WithKeyValue("get_poi", get_poi.ToString())
                           .WithKeyValue("poi_options", poi_options.ToString())
                           .WithKeyValue("key", key)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapLocationToAddressResponse <LocationToAddress> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// IP定位:通过终端设备IP地址获取其当前所在地理位置,精确到市级,常用于显示当地城市天气预报、初始化用户城市等非精确定位场景。
        /// </summary>
        /// <param name="key">开发密钥(Key)</param>
        /// <param name="ip">IP地址,缺省时会使用请求端的IP</param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static MapResponse <IpLocationResult> IpLocation(string ip, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/location/v1/ip")
                           .WithKeyValue("key", key)
                           .WithKeyValue("ip", ip)
                           .WithKeyValue("output", "json")
                           .BuildQueryString();
            string url = host + query;

            var response = Get <MapResponse <IpLocationResult> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 9
0
        /// <summary>
        ///  距离矩阵(DistanceMatrix),用于批量计算一组起终点的路面距离(或称导航距离),可应用于网约车派单、多目的地最优路径智能计算等场景中,支持驾车、步行、骑行多种交通方式,满足不同应用需要。
        /// </summary>
        /// <param name="mode">计算方式,取值:driving:驾车 walking:步行 bicycling:自行车</param>
        /// <param name="from">起点坐标 格式: lat,lng[, heading];lat,lng[, heading] from=39.071510,117.190091  from=39.071510,117.190091,270;39.108951,117.279396,180</param>
        /// <param name="to">终点坐标 格式: lat,lng;lat,lng…</param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static MapResponse <DistanceMatrix> DistanceMatrix(string mode, string from, string to, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/distance/v1/matrix")
                           .WithKeyValue("key", key)
                           .WithKeyValue("mode", mode)
                           .WithKeyValue("from", from)
                           .WithKeyValue("to", to)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <DistanceMatrix> >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取下级行政区划
        /// </summary>
        /// <param name="keyword">搜索关键词:1.支持输入一个文本关键词2.支持多个行政区划代码(adcode),英文逗号分隔</param>
        /// <param name="get_polygon">返回行政区划轮廓点串(经纬度点串),0 默认,不返回轮廓1 包含海域,3公里抽稀粒度 2 纯陆地行政区划,可通过max_offset设置返回轮廓的抽稀级别</param>
        /// <param name="max_offset">轮廓点串的抽稀精度(仅对get_polygon=2时支持),单位米,可选值:100 :100米(当缺省id返回省级区划时,将按500米返回,其它级别正常生效) 500 :500米 1000:1000米 3000:3000米</param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static AreaResponse <List <List <Area> > > SearchAreas(string keyword, int get_polygon, string max_offset, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/district/v1/search")
                           .WithKeyValue("key", key)
                           .WithKeyValue("keyword", keyword)
                           .WithKeyValue("get_polygon", get_polygon.ToString())
                           .WithKeyValue("max_offset", max_offset)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <AreaResponse <List <List <Area> > > >(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///  地点搜索(search接口)
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="boundary"></param>
        /// <param name="filter"></param>
        /// <param name="orderby">排序,目前仅周边搜索(boundary=nearby)支持按距离由近到远排序,取值:_distance</param>
        /// <param name="page_size"></param>
        /// <param name="page_index"></param>
        /// <param name="key"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        public static SearchResponse Search(string keyword, string boundary, string filter, string orderby, int?page_size, int?page_index, string key, string secretKey)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/place/v1/search")
                           .WithKeyValue("key", key, true)
                           .WithKeyValue("keyword", keyword)
                           .WithKeyValue("boundary", boundary)
                           .WithKeyValue("filter", filter, true)
                           .WithKeyValue("orderby", orderby)
                           .WithKeyValue("page_size", page_size?.ToString())
                           .WithKeyValue("page_index", page_index?.ToString())
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <SearchResponse>(url, out string body);

            response.Body = body;
            return(response);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 静态图API,是通过构造一个HTTP协议的URL调用,获取一张地图的静态图片,可以通过参数指定地图位置、缩放级别、底图类型、叠加的覆盖物等。
        /// </summary>
        /// <param name="size">地图静态图片大小,宽*高,单位像素。 size=138*187</param>
        /// <param name="key">开发者密钥</param>
        /// <param name="center">地图视图中心点,为经纬度坐标。center=39.12,116.54</param>
        /// <param name="zoom">地图视图的级别设置,取值范围4≤zoom≤18,18级仅在maptype=roadmap时支持 zoom=10</param>
        /// <param name="bounds">
        /// 通过设置一个矩形范围来显示地图
        /// 1. 系统会自动计算合适的缩放级别,以便设置的范围完整显示在图中
        /// 2. 本参数优先级高于center+zoom的组合参数
        /// 3. 参数格式:
        /// bounds=lat,lng;lat,lng
        /// 矩形范围西南角坐标 和 东北角坐标,两坐标英文分号 " ; " 分隔, 纬度在前,经度在后,英文逗号" , " 分隔。 bounds=39.933828,116.472588;39.960675,116.497993</param>
        /// <param name="format">支持png(默认),png8,gif,jpg format=png</param>
        /// <param name="scale">是否高清,取值2为高清,取值1为普清 scale=2</param>
        /// <param name="maptype">
        /// 底图类型,支持5种底图展示效果:
        /// 普通路网,roadmap
        /// 卫星,satellite
        /// 地形图,landform
        /// 地形叠加路网,terrain
        /// 卫星叠加路网,hybrid
        /// maptype=roadmap
        ///</param>
        /// <param name="markers">用于标注图标,详见图标(Markers)</param>
        /// <param name="labels">用于标注文本,详见文本(labels)</param>
        /// <param name="path">用于标记一条路径,详见路径(path)</param>
        /// <param name="secretKey"></param>
        public static MapResponse <string> GetStaicMap(string size, string key, string center = null, string zoom = null, string bounds = null, string format = null, int scale = 2, string maptype = null, string markers = null, string labels = null, string path = null, string secretKey = null)
        {
            string query = GetRequestBuilder.Create(secretKey, "/ws/staticmap/v2")
                           .WithKeyValue("size", size)
                           .WithKeyValue("key", key)
                           .WithKeyValue("center", center)
                           .WithKeyValue("zoom", zoom)
                           .WithKeyValue("bounds", bounds)
                           .WithKeyValue("format", format)
                           .WithKeyValue("scale", scale.ToString())
                           .WithKeyValue("maptype", maptype)
                           .WithKeyValue("markers", markers)
                           .WithKeyValue("labels", labels)
                           .WithKeyValue("path", path)
                           .BuildQueryString();
            string url      = host + query;
            var    response = Get <MapResponse <string> >(url, out string body);

            response.Body = body;
            return(response);
        }