随笔- 69  文章- 36  评论- 7  阅读- 23万 
2025年1月22日
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<%@ WebHandler Language="C#" Class="openstreetmap" %>
 
using System;
using System.Web;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
 
public class openstreetmap : IHttpHandler
{
 
    public void ProcessRequest(HttpContext context)
    {
        //context.Response.ContentType = "text/plain";
        string lat = context.Request["lat"].ToString();
        string lon = context.Request["lon"].ToString();
        // 要调用的URL
        string url = "https://nominatim.openstreetmap.org/reverse?format=json&lat=" + lat + "&lon=" + lon + "&zoom=18&addressdetails=1";
        string response = GetHttpClient(url);
        context.Response.Write(response);
        context.Response.End();
    }
    private string GetHttpClient(string url)
    {
        string responsejson = "";
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.UserAgent.ParseAdd("dxm-int/2.0");
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            // string url = $"https://nominatim.openstreetmap.org/reverse?format=json&lat={latitude}&lon={longitude}&zoom=18&addressdetails=1";
            var request = new HttpRequestMessage(HttpMethod.Get, url);
            request.Headers.Referrer = new Uri("https://dxmint.yng.com.cn/");
            HttpResponseMessage response = client.SendAsync(request).Result;
            if (response.IsSuccessStatusCode)
            {
                 responsejson=  response.Content.ReadAsStringAsync().Result;
                
            }
            else
            {
                responsejson= "获取地址接口异常";
            }
        }
        return responsejson;
    }
 
 
 
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
 
}

  

posted @ 2025-01-22 15:56 代码改变世界&1024 阅读(7) 评论(0) 推荐(0) 编辑
2024年9月11日
摘要: 在SQL中,你可以使用ROW_NUMBER()函数来为结果集中的每一行新增一个序号。这个序号是基于某个排序条件的分区排序结果。 以下是一个简单的例子,假设我们有一个名为students的表,它有两列:class_id和student_name。我们想为同一个班级内的学生创建一个序号,按照studen 阅读全文
posted @ 2024-09-11 11:09 代码改变世界&1024 阅读(385) 评论(0) 推荐(0) 编辑
2023年2月16日
摘要: SELECT s.Name AS SchemaName, t.Name AS TableName, p.rows AS RowCounts--, --CAST(ROUND((SUM(a.used_pages) / 128.00), 2) AS NUMERIC(36, 2)) AS Used_MB, 阅读全文
posted @ 2023-02-16 11:31 代码改变世界&1024 阅读(31) 评论(0) 推荐(0) 编辑
2022年6月20日
摘要: MVC中设置文本框不可修改(@Html.TextBox) mvc前台: @Html.TextBox("id",“name", new {@Readonly = "True" }) id:是文本框的名称,eg:@Html.TextBox("dome1") name:是显示在文本框中的值,@Html.T 阅读全文
posted @ 2022-06-20 11:25 代码改变世界&1024 阅读(401) 评论(0) 推荐(0) 编辑
2022年6月5日
摘要: USE[master] ALTER DATABASE 数据库名 SET RECOVERY SIMPLE WITH NO_WAIT ALTER DATABASE 数据库名 SET RECOVERY SIMPLE --简单模式 USE 数据库名 DBCC SHRINKFILE (N'数据库名_log' 阅读全文
posted @ 2022-06-05 11:27 代码改变世界&1024 阅读(27) 评论(0) 推荐(0) 编辑
2022年3月3日
摘要: static string accountName = "发件人邮箱"; static string password = "发件人邮箱密码"; static string smtpServer = "smtp.qiye.aliyun.com"; static int smtpPort = 80; 阅读全文
posted @ 2022-03-03 17:11 代码改变世界&1024 阅读(115) 评论(0) 推荐(0) 编辑
2022年1月13日
摘要: 最近在做reporting services报表的时候,部署到sharepoint后,打开rdl报表,经常遇到一个问题: 报表服务器数据库内出错。此错误可能是因连接失败、超时或数据库中磁盘空间不足而导致的。 > Microsoft.ReportingServices.Diagnostics.Util 阅读全文
posted @ 2022-01-13 11:05 代码改变世界&1024 阅读(418) 评论(0) 推荐(0) 编辑
2021年8月20日
摘要: 1 DECLARE @WeekDays TABLE 2 ( 3 freq_interval INT, 4 weekdays NVARCHAR(120) 5 6 ) 7 8 INSERT INTO @WeekDays 9 SELECT 1 ,N'星期日 ' UNION ALL 10 SELECT 2 阅读全文
posted @ 2021-08-20 12:35 代码改变世界&1024 阅读(135) 评论(0) 推荐(0) 编辑
2021年7月26日
摘要: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>amazeUI</title> 6 <script src="amazeui-2.5.2/js/jquery.min.js"></scrip 阅读全文
posted @ 2021-07-26 16:48 代码改变世界&1024 阅读(209) 评论(0) 推荐(0) 编辑
2021年7月12日
摘要: 1 -- 查询死锁 2 --第一种 3 sp_lock 4 5 --第二种 6 select object_name(resource_associated_entity_id) as tableName, request_session_id as pid,* from sys.dm_tran_l 阅读全文
posted @ 2021-07-12 17:02 代码改变世界&1024 阅读(421) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示