在网页使用高德,百度地图这些时,会因为没有购买他们的使用版权,从而出现以下水印,因此需要换一个地图-天地图
天地图官方文档:http://lbs.tianditu.gov.cn/
然而天地图并不像其他地图一样这么方便,比如没有可以通过地址搜索,直接可以获取坐标的,因此可以小改动一下,方便自己使用。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="天地图" />
<title>天地图-坐标拾取</title>
<style type="text/css">
body,
html {
width: 100%;
height: 100%;
margin: 0;
font-family: "Microsoft YaHei";
overflow: hidden;
}
#mapDiv {
width: 100%;
height: 400px
}
input,
b,
p {
color: #666;
font-size: 12px;
margin: auto;
}
.maptxt {
display: flex;
position: fixed;
width: 100%;
top: 0;
left: 0;
z-index: 555;
background: #fff;
justify-content: space-between;
align-items: center;
padding: 50px 110px 20px 30px;
box-sizing: border-box;
}
#searchPoint {
border-radius: 0;
border: 1px solid #e0e0e0;
height: 30px;
padding-left: 10px;
outline: none;
width: 300px;
}
#searchPoint::placeholder {
font-size: 12px;
}
#mapDiv {
height: 100vh;
}
.button {
background: #e0e0e0;
border: none;
padding: 6.5px 10px;
color: #555;
font-size: 14px;
cursor: pointer;
margin-left: 10px;
transition: all .3s;
}
.button:hover{
background: #3385ff;
color: #fff;
}
.flex {
display: flex;
align-items: center;
position: relative;
margin-top: 10px;
}
#coordinate {
padding: 0;
cursor: pointer;
background: #FFF;
color: #555;
width:200px;
height: 30px;
line-height: 30px;
font-size: 14px;
font-weight: 700;
box-shadow: 1px 2px 1px rgba(0, 0, 0, .15);
}
#copyButton {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: none;
width: 30px;
height: 30px;
background: #3385ff;
background-size: 15px 15px;
position: relative;
z-index: 3;
}
.fl .txt{
display: flex;
align-items: center;
}
#copyButton svg {
width: 70%;
height: 80%;
}
#copy {
position: absolute;
top: -18px;
right: -5px;
transition: all .6s;
opacity: 0;
pointer-events: none;
}
#copy.on {
top: -40px;
opacity: 1;
}
#copy .p {
color: rgb(255, 0, 0);
font-size: 12px;
position: absolute;
top: -25px;
right: -38px;
white-space: nowrap;
background: #fff;
padding:5px 10px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, .05);
}
#copy .p:after {
content: "";
width: 0;
height: 0;
border: 7px solid transparent;
border-top-color: #fff;
position: absolute;
left: -15px;
right: 0;
margin: auto;
bottom: -14px;
}
#copy .dlam {
width: 40px;
margin: auto;
}
#copy .dlam svg {
width: 100%;
}
.fl p{
margin-bottom: 10px;
}
</style>
</head>
<body onLoad="onLoad()">
<div class="maptxt">
<div class="fl">
<p>地址前面尽量带市</p>
<div class="txt">
<input type="text" id="searchPoint" value="" placeholder="请输入地址" />
<input type="button" value="搜索" class="button" onclick="search();" />
</div>
</div>
<div class="fr">
<p>当前坐标如下:</p>
<div class="flex">
<div id="copy">
<div class="dlam"><svg t="1711418006113" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="9630" width="50" height="50">
<path
d="M833.1 886.7H190.9C114.5 808.2 67.6 701.9 67.6 584.8c0-194.5 129.5-359.4 308.6-416.2h-0.9c43.1-13.7 89-21 136.7-21 47.7 0 93.6 7.4 136.7 21h-0.9c179.1 56.8 308.6 221.7 308.6 416.2 0 117.1-46.9 223.4-123.3 301.9z"
fill="#FFFFFF" p-id="9631"></path>
<path
d="M833.5 887.7h-643l-0.3-0.3C110.5 805.5 66.6 698 66.6 584.8c0-94.5 30.2-184.5 87.4-260.3 27.5-36.5 60.4-68.4 97.9-95 36.2-25.7 75.9-45.8 118.1-59.8h-1.1l6.2-2c44.1-14 90.2-21.1 137-21.1s92.9 7.1 137 21.1l6.2 2h-1.1c42.1 14 81.8 34.1 118.1 59.8 37.5 26.6 70.4 58.6 97.9 95 57.1 75.8 87.4 165.8 87.4 260.3 0 113.2-43.9 220.7-123.6 302.6l-0.5 0.3z m-642.2-2h641.3c79.2-81.5 122.7-188.3 122.7-300.9 0-189.9-123.8-356.8-307.9-415.2l-6.2-2h0.8c-42-12.6-85.7-19-130.1-19-44.4 0-88.1 6.4-130.1 19h0.8l-6.2 2C192.4 228 68.6 394.9 68.6 584.8c0 112.6 43.6 219.4 122.7 300.9z"
p-id="9632"></path>
<path
d="M795.2 887l-0.7-0.7c70-71.9 108.5-166.2 108.5-265.6 0-167.5-109.1-314.7-271.6-366.2l0.3-1c39.1 12.4 75.8 30.7 109.2 54.4 33 23.4 62 51.5 86.2 83.6 50.3 66.7 76.9 145.9 76.9 229.1 0 99.8-38.6 194.3-108.8 266.4z"
p-id="9633"></path>
<path
d="M795.3 888.4l-2.2-2.1 0.7-0.7C863.6 813.9 902 719.8 902 620.7c0-167.1-108.9-313.8-270.9-365.2l-1-0.3 0.9-2.9 1 0.3c39.2 12.4 76 30.8 109.5 54.5 33.1 23.5 62.1 51.7 86.4 83.9 50.4 66.9 77.1 146.3 77.1 229.7 0 99.9-38.7 194.7-109.1 267l-0.6 0.7zM228.8 887C158.6 814.9 120 720.4 120 620.7c0-83.2 26.6-162.4 76.9-229.1 24.2-32.1 53.2-60.2 86.2-83.6 33.4-23.7 70.1-42 109.2-54.4l0.3 1C230.1 306.1 121 453.2 121 620.7c0 99.4 38.5 193.7 108.5 265.6l-0.7 0.7z"
p-id="9634"></path>
<path
d="M228.8 888.4l-0.7-0.7C157.7 815.5 119 720.6 119 620.7c0-83.4 26.7-162.9 77.1-229.7 24.3-32.2 53.3-60.4 86.4-83.9C316 283.4 352.8 265 392 252.6l1-0.3 0.9 2.9-1 0.3C230.8 306.9 122 453.7 122 620.7c0 99.1 38.4 193.2 108.2 264.9l0.7 0.7-2.1 2.1z"
p-id="9635"></path>
<path
d="M450.6 378.3c-34.1 0-61.9-43.7-61.9-97.4s27.8-97.4 61.9-97.4 61.9 43.7 61.9 97.4-27.8 97.4-61.9 97.4z m0-193.8c-33.6 0-60.9 43.3-60.9 96.4s27.3 96.4 60.9 96.4 60.9-43.3 60.9-96.4-27.3-96.4-60.9-96.4z"
fill="#FFFFFF" p-id="9636"></path>
<path
d="M450.6 379.3c-34.7 0-62.9-44.2-62.9-98.4 0-54.3 28.2-98.4 62.9-98.4s62.9 44.2 62.9 98.4c0 54.3-28.2 98.4-62.9 98.4z m0-193.8c-33 0-59.9 42.8-59.9 95.4 0 52.6 26.9 95.4 59.9 95.4s59.9-42.8 59.9-95.4c0-52.6-26.9-95.4-59.9-95.4z"
p-id="9637"></path>
<path
d="M499.4 299.1c0 18.1-8.2 32.7-18.2 32.7S463 317.1 463 299.1c0-18.1 8.2-32.7 18.2-32.7s18.2 14.6 18.2 32.7z m-12.6-6c-3.9 0-7 5.5-7 12.4s3.1 12.4 7 12.4 7-5.5 7-12.4-3.2-12.4-7-12.4z"
p-id="9638"></path>
<path
d="M481.1 332.8c-10.6 0-19.2-15.1-19.2-33.7s8.6-33.7 19.2-33.7 19.2 15.1 19.2 33.7-8.6 33.7-19.2 33.7z m0-65.5c-9.5 0-17.2 14.2-17.2 31.7s7.7 31.7 17.2 31.7 17.2-14.2 17.2-31.7c0.1-17.4-7.7-31.7-17.2-31.7z m5.7 51.6c-4.5 0-8-5.9-8-13.4s3.5-13.4 8-13.4 8 5.9 8 13.4-3.5 13.4-8 13.4z m0-24.8c-3.3 0-6 5.2-6 11.4s2.8 11.4 6 11.4c3.3 0 6-5.2 6-11.4s-2.8-11.4-6-11.4z"
p-id="9639"></path>
<path
d="M573.4 378.3c-34.1 0-61.9-43.7-61.9-97.4s27.8-97.4 61.9-97.4 61.9 43.7 61.9 97.4-27.8 97.4-61.9 97.4z m0-193.8c-33.6 0-60.9 43.3-60.9 96.4s27.3 96.4 60.9 96.4 60.9-43.3 60.9-96.4-27.3-96.4-60.9-96.4z"
fill="#FFFFFF" p-id="9640"></path>
<path
d="M573.4 379.3c-34.7 0-62.9-44.2-62.9-98.4 0-54.3 28.2-98.4 62.9-98.4s62.9 44.2 62.9 98.4c0 54.3-28.2 98.4-62.9 98.4z m0-193.8c-33 0-59.9 42.8-59.9 95.4 0 52.6 26.9 95.4 59.9 95.4s59.9-42.8 59.9-95.4c0-52.6-26.9-95.4-59.9-95.4z"
p-id="9641"></path>
<path
d="M542.9 266.3c10.1 0 18.2 14.7 18.2 32.7 0 18.1-8.2 32.7-18.2 32.7S524.7 317 524.7 299c-0.1-18 8.1-32.7 18.2-32.7z m-12.7 39.2c0 6.8 3.1 12.4 7 12.4s7-5.5 7-12.4-3.1-12.4-7-12.4-7 5.6-7 12.4z"
p-id="9642"></path>
<path
d="M542.9 332.8c-10.6 0-19.2-15.1-19.2-33.7s8.6-33.7 19.2-33.7 19.2 15.1 19.2 33.7-8.6 33.7-19.2 33.7z m0-65.5c-9.5 0-17.2 14.2-17.2 31.7s7.7 31.7 17.2 31.7 17.2-14.2 17.2-31.7c0-17.4-7.7-31.7-17.2-31.7z m-5.7 51.6c-4.5 0-8-5.9-8-13.4s3.5-13.4 8-13.4 8 5.9 8 13.4-3.5 13.4-8 13.4z m0-24.8c-3.3 0-6 5.2-6 11.4s2.8 11.4 6 11.4 6-5.2 6-11.4-2.7-11.4-6-11.4z"
p-id="9643"></path>
<path
d="M859.7 887.2l-0.7-0.7c85.5-87.8 132.5-203 132.5-324.4 0-259.2-215.1-470-479.5-470S32.5 302.9 32.5 562.1c0 121.4 47.1 236.6 132.5 324.4l-0.7 0.7c-85.6-88-132.8-203.4-132.8-325.1 0-63.6 12.7-125.3 37.8-183.3 24.2-56.1 58.8-106.5 103-149.7 44.1-43.3 95.5-77.2 152.7-100.9 59.2-24.6 122.2-37 187-37s127.8 12.5 187 37c57.2 23.7 108.6 57.7 152.7 100.9 44.1 43.3 78.8 93.6 103 149.7 25.1 58.1 37.8 119.8 37.8 183.3 0 121.6-47.2 237.1-132.8 325.1z"
p-id="9644"></path>
<path
d="M859.7 888.6l-2.2-2.1 0.7-0.7c85.3-87.6 132.2-202.6 132.2-323.7 0-258.6-214.6-469-478.5-469-263.8 0-478.5 210.4-478.5 469 0 121.1 47 236.1 132.2 323.7l0.7 0.7-2.2 2.1-0.7-0.7C77.8 799.7 30.5 684 30.5 562.1c0-63.7 12.7-125.5 37.8-183.7 24.3-56.2 59-106.7 103.2-150s95.7-77.4 153-101.1C384 102.6 447 90.1 512 90.1s128 12.5 187.4 37.1c57.3 23.8 108.8 57.8 153 101.1s78.9 93.8 103.2 150c25.1 58.2 37.8 120 37.8 183.7 0 121.9-47.3 237.6-133.1 325.8l-0.6 0.8z"
p-id="9645"></path>
<path
d="M536.5 365.4c0 13.2-10.9 24-24.5 24-13.5 0-24.5-10.7-24.5-24s10.9-24 24.5-24c13.5 0 24.5 10.8 24.5 24z m-32.6-15.8c-4.5 0-8.1 3.5-8.1 7.9s3.6 7.9 8.1 7.9 8.1-3.5 8.1-7.9-3.6-7.9-8.1-7.9z"
fill="#FF0000" p-id="9646"></path>
<path
d="M512 390.4c-14 0-25.5-11.2-25.5-25s11.4-25 25.5-25 25.5 11.2 25.5 25-11.5 25-25.5 25z m0-48c-12.9 0-23.5 10.3-23.5 23s10.5 23 23.5 23c12.9 0 23.5-10.3 23.5-23 0-12.6-10.6-23-23.5-23z m-8.1 24c-5 0-9.1-4-9.1-8.9s4.1-8.9 9.1-8.9 9.1 4 9.1 8.9-4.1 8.9-9.1 8.9z m0-15.8c-3.9 0-7.1 3.1-7.1 6.9s3.2 6.9 7.1 6.9 7.1-3.1 7.1-6.9-3.2-6.9-7.1-6.9z"
p-id="9647"></path>
<path
d="M512 389.9c-13.8 0-25-11-25-24.5s11.2-24.5 25-24.5 25 11 25 24.5-11.2 24.5-25 24.5z m0-48c-13.2 0-24 10.5-24 23.5 0 12.9 10.7 23.5 24 23.5 13.2 0 24-10.5 24-23.5 0-12.9-10.8-23.5-24-23.5z m-8.1 24c-4.7 0-8.6-3.8-8.6-8.4s3.8-8.4 8.6-8.4c4.7 0 8.6 3.8 8.6 8.4s-3.8 8.4-8.6 8.4z m0-15.8c-4.2 0-7.6 3.3-7.6 7.4s3.4 7.4 7.6 7.4c4.2 0 7.6-3.3 7.6-7.4s-3.4-7.4-7.6-7.4z"
p-id="9648"></path>
<path
d="M512 390.9c-14.3 0-26-11.4-26-25.5s11.6-25.5 26-25.5c14.3 0 26 11.4 26 25.5s-11.7 25.5-26 25.5z m0-48c-12.7 0-23 10.1-23 22.5s10.3 22.5 23 22.5 23-10.1 23-22.5-10.3-22.5-23-22.5z m-8.1 24c-5.3 0-9.6-4.2-9.6-9.4s4.3-9.4 9.6-9.4 9.6 4.2 9.6 9.4-4.3 9.4-9.6 9.4z m0-15.8c-3.6 0-6.6 2.9-6.6 6.4s2.9 6.4 6.6 6.4 6.6-2.9 6.6-6.4-2.9-6.4-6.6-6.4z"
p-id="9649"></path>
<path d="M829.7 627.9C767.2 770.7 648.3 867.1 512 867.1s-255.2-96.4-317.7-239.2" fill="#FFFFFF"
p-id="9650"></path>
<path
d="M512 868.1c-66 0-130.7-22.9-187.1-66.3-54.7-42.1-100.2-102.1-131.5-173.5l1.8-0.8C259.7 774.7 381.1 866.1 512 866.1s252.3-91.4 316.8-238.6l1.8 0.8c-31.3 71.5-76.8 131.5-131.5 173.5-56.4 43.4-121.1 66.3-187.1 66.3z"
p-id="9651"></path>
<path
d="M512 867.6c-65.9 0-130.5-22.9-186.8-66.2-54.7-42-100.1-102-131.3-173.3l0.9-0.4C259.3 775.1 380.9 866.6 512 866.6s252.7-91.5 317.2-238.9l0.9 0.4c-31.3 71.4-76.7 131.3-131.3 173.3-56.3 43.3-120.9 66.2-186.8 66.2z"
p-id="9652"></path>
<path
d="M512 868.6c-66.1 0-131-22.9-187.4-66.4-54.8-42.1-100.3-102.2-131.7-173.7l-0.4-0.9 2.7-1.2 0.4 0.9c64.4 147 185.6 238.3 316.3 238.3 130.7 0 251.9-91.3 316.3-238.3l0.4-0.9 2.7 1.2-0.4 0.9c-31.3 71.5-76.8 131.6-131.6 173.7-56.3 43.5-121.2 66.4-187.3 66.4z"
p-id="9653"></path>
<path
d="M519.5 650.5h-15c-157.3 0-293.6-12.4-339.1-30.7-19.6-8.2-32.3-26.4-32.3-46.2 0-28 24.7-50.7 55.1-50.7v1c-29.8 0-54.1 22.3-54.1 49.7 0 19.4 12.4 37.2 31.7 45.3 44.7 18.1 184 30.7 338.7 30.7h15c154.8 0 294.1-12.6 338.7-30.7 19.2-8.1 31.7-25.8 31.7-45.3 0-27.4-24.3-49.7-54.1-49.7v-1c30.4 0 55.1 22.8 55.1 50.7 0 19.8-12.7 38-32.3 46.2-45.4 18.3-181.7 30.7-339.1 30.7z"
p-id="9654"></path>
<path
d="M519.5 651.5h-15c-157.5 0-293.9-12.4-339.5-30.8-20-8.4-32.9-26.9-32.9-47.1 0-28.5 25.2-51.7 56.1-51.7h1v3h-1c-29.3 0-53.1 21.9-53.1 48.7 0 19 12.2 36.4 31 44.4 44.5 18 183.7 30.6 338.3 30.6h15c154.7 0 293.8-12.6 338.4-30.6 18.8-7.9 31-25.3 31-44.3 0-26.9-23.8-48.7-53.1-48.7h-1v-3h1c30.9 0 56.1 23.2 56.1 51.7 0 20.2-12.9 38.7-32.9 47.1-45.5 18.3-181.9 30.7-339.4 30.7z"
p-id="9655"></path>
<path
d="M829.8 628.4c-65 13.6-179.5 22.7-310 22.7h-15.6c-130.5 0-245-9-310-22.7l0.1-0.5C256.8 770.7 375.7 867.1 512 867.1s255.2-96.4 317.7-239.2"
fill="#ED1C24" p-id="9656"></path>
<path
d="M512 868.1c-66 0-130.7-22.9-187.1-66.3-54.5-41.9-99.7-101.5-131-172.5l-0.8-0.2 1-4.5 1.3 2.9v0.1c67.8 14.1 183.1 22.5 308.9 22.5h15.6c125.8 0 241.2-8.4 308.9-22.5v-0.1l0.1 0.1c0.2 0 0.5-0.1 0.7-0.1l0.1 0.5 0.9 0.4c-31.3 71.5-76.8 131.5-131.5 173.5-56.4 43.3-121.1 66.2-187.1 66.2zM196.3 629.8C261 775.7 381.8 866.1 512 866.1s251-90.5 315.7-236.3C759.6 643.7 644.8 652 519.8 652h-15.6c-125.1 0.1-239.9-8.2-307.9-22.2z"
p-id="9657"></path>
<path
d="M512 867.6c-65.9 0-130.5-22.9-186.8-66.2-54.5-41.9-99.7-101.5-131-172.5h-0.1l-0.5-0.1 0.5-2.5 0.6 1.4c0 0.1 0.1 0.2 0.1 0.3 67.7 14.1 183.3 22.5 309.3 22.5h15.6c126 0 241.5-8.4 309.3-22.5 0-0.1 0.1-0.2 0.1-0.3l0.9 0.4-0.3 0.6v0.1h-0.1c-31.2 71-76.5 130.7-131 172.5-56.1 43.4-120.7 66.3-186.6 66.3zM195.4 629.2C260.1 775.7 381.3 866.6 512 866.6c130.7 0 251.9-90.9 316.6-237.4-67.9 14-183.2 22.4-308.8 22.4h-15.6c-125.6 0-240.9-8.4-308.8-22.4z"
p-id="9658"></path>
<path
d="M512 868.6c-66.1 0-131-22.9-187.4-66.4-54.5-41.9-99.8-101.5-131.1-172.5l-1.1-0.2 1.4-6.5 1.8 4.1c67.7 14 183 22.4 308.6 22.4h15.6c125.5 0 240.8-8.4 308.6-22.4l0.3-0.8 2.8 1.2-0.6 1.3 0.2 0.8-0.6 0.1c-31.3 71-76.6 130.6-131.1 172.5-56.4 43.5-121.3 66.4-187.4 66.4zM197.1 630.5C261.8 775.6 382.3 865.6 512 865.6s250.2-90 314.9-235.1c-68.2 13.8-182.7 22-307.1 22h-15.6c-124.4 0.1-238.9-8.2-307.1-22z"
p-id="9659"></path>
<path
d="M670.1 820.3c0-59.5-40.6-107.9-90.4-107.9-25.7 0-50.2 13.1-67.3 36l-0.4 0.5-0.4-0.5c-17.1-22.9-41.7-36-67.3-36-49.8 0-90.3 48.4-90.4 107.9h-1c0-60.1 41-108.9 91.4-108.9 25.8 0 50.4 13.1 67.7 35.8 17.3-22.8 42-35.8 67.7-35.8 50.3 0 91.3 48.9 91.4 108.9h-1z"
p-id="9660"></path>
<path
d="M672.1 821.3h-3v-1c0-59-40.1-106.9-89.4-106.9-25.3 0-49.6 13-66.5 35.6l-1.2 1.6-1.2-1.6c-16.9-22.6-41.2-35.6-66.5-35.6-49.2 0-89.3 48-89.4 106.9v1h-3v-1c0-60.6 41.5-109.9 92.4-109.9 25.7 0 50.3 12.8 67.7 35.2 17.4-22.4 42.1-35.2 67.7-35.2 50.9 0 92.3 49.3 92.4 109.9v1z"
p-id="9661"></path>
<path
d="M670.6 820.3c0-59.9-40.7-108.4-90.9-108.4-26.9 0-51.1 14-67.7 36.2-16.6-22.2-40.8-36.2-67.7-36.2-50.2 0-90.8 48.5-90.9 108.4l-0.1 0.1c48 29.9 101.8 46.7 158.6 46.7s110.6-16.8 158.6-46.7"
fill="#F7931E" p-id="9662"></path>
<path
d="M512 868.1c-55.8 0-109.3-15.8-159.2-46.8l-0.8-0.5 0.4-0.7c0.2-60.2 41.3-109.2 91.9-109.2 25.7 0 50.3 12.9 67.7 35.5 17.4-22.6 42-35.5 67.7-35.5 50.6 0 91.8 49.1 91.9 109.4h-1.1l0.6 1c-49.8 31.1-103.3 46.8-159.1 46.8z m-157.6-48.2c49.4 30.7 102.4 46.2 157.6 46.2 55.2 0 108.2-15.5 157.6-46.2-0.2-59.1-40.5-107-89.9-107-25.5 0-49.9 13-66.9 35.8l-0.8 1.1-0.8-1.1c-17-22.7-41.4-35.8-66.9-35.8-49.4 0-89.6 47.9-89.9 107z"
p-id="9663"></path>
<path
d="M512 867.6c-55.7 0-109.2-15.7-158.9-46.8l-0.4-0.3 0.2-0.4c0.1-60 41.1-108.8 91.4-108.8 25.8 0 50.4 13.1 67.7 35.8 17.3-22.8 42-35.8 67.7-35.8 50.3 0 91.3 48.9 91.4 108.9h-0.6l0.3 0.6c-49.7 31.1-103.1 46.8-158.8 46.8z m-158.1-47.4c49.5 30.8 102.7 46.4 158.1 46.4 55.4 0 108.6-15.6 158.1-46.4-0.1-59.5-40.6-107.8-90.4-107.8-25.7 0-50.2 13.1-67.3 36l-0.4 0.5-0.4-0.5c-17.1-22.9-41.7-36-67.3-36-49.7 0-90.2 48.3-90.4 107.8z"
p-id="9664"></path>
<path
d="M512 868.6c-55.9 0-109.5-15.8-159.4-46.9l-1.3-0.8 0.6-1c0.2-60.4 41.6-109.5 92.4-109.5 25.7 0 50.3 12.8 67.7 35.2 17.4-22.4 42.1-35.2 67.7-35.2 50.9 0 92.3 49.3 92.4 109.9v0.6l0.1 0.2-0.8 0.5c-49.9 31.2-103.5 47-159.4 47z m-157.1-49c49.2 30.5 102.1 46 157.1 46s107.8-15.4 156.9-45.9l-0.2-0.4h0.4c-0.5-58.5-40.4-105.9-89.4-105.9-25.3 0-49.6 13-66.5 35.6l-1.2 1.6-1.2-1.6c-16.9-22.6-41.2-35.6-66.5-35.6-49 0-89 47.6-89.4 106.2z"
p-id="9665"></path>
<path d="M511.5 389.4h1v260.5h-1z" p-id="9666"></path>
<path d="M510.5 388.4h3v262.5h-3z" p-id="9667"></path>
<path
d="M862.2 904H161.8c-2.4 0-4.3-2-4.3-4.3V891c0-2.4 2-4.3 4.3-4.3h700.4c2.4 0 4.3 2 4.3 4.3v8.7c0 2.4-1.9 4.3-4.3 4.3z"
fill="#ED1C24" p-id="9668"></path>
<path
d="M862.2 905H161.8c-2.9 0-5.3-2.4-5.3-5.3V891c0-2.9 2.4-5.3 5.3-5.3h700.4c2.9 0 5.3 2.4 5.3 5.3v8.7c0 2.9-2.4 5.3-5.3 5.3z m-700.4-17.3c-1.8 0-3.3 1.5-3.3 3.3v8.7c0 1.8 1.5 3.3 3.3 3.3h700.4c1.8 0 3.3-1.5 3.3-3.3V891c0-1.8-1.5-3.3-3.3-3.3H161.8z"
p-id="9669"></path>
<path
d="M862.2 904.5H161.8c-2.7 0-4.8-2.2-4.8-4.8V891c0-2.7 2.2-4.8 4.8-4.8h700.4c2.7 0 4.8 2.2 4.8 4.8v8.7c0 2.6-2.1 4.8-4.8 4.8z m-700.4-17.3c-2.1 0-3.8 1.7-3.8 3.8v8.7c0 2.1 1.7 3.8 3.8 3.8h700.4c2.1 0 3.8-1.7 3.8-3.8V891c0-2.1-1.7-3.8-3.8-3.8H161.8z"
p-id="9670"></path>
<path
d="M862.2 905.5H161.8c-3.2 0-5.8-2.6-5.8-5.8V891c0-3.2 2.6-5.8 5.8-5.8h700.4c3.2 0 5.8 2.6 5.8 5.8v8.7c0 3.2-2.6 5.8-5.8 5.8z m-700.4-17.3c-1.6 0-2.8 1.3-2.8 2.8v8.7c0 1.6 1.3 2.8 2.8 2.8h700.4c1.6 0 2.8-1.3 2.8-2.8V891c0-1.6-1.3-2.8-2.8-2.8H161.8z"
p-id="9671"></path>
<path
d="M859.5 886.8c-0.5-0.1-1-0.1-1.5-0.1H166.3c-0.6 0-1.2 0.1-1.7 0.2h0.2C82.5 802.4 32 688 32 562.1 32 302.2 246.9 91.6 512 91.6s480 210.7 480 470.5c0 125.9-50.5 240.3-132.7 324.7m-630.2-0.2h565.7v0.2c67.3-69.2 108.6-162.8 108.6-265.9 0-171.4-114.1-316.6-271.9-366.7l0.9 0.3c-7.3-40.6-31-70.4-59.1-70.4-33.8 0-61.2 43.1-61.4 96.4l-0.1 3.2c0.1-0.9 0.1-1.7 0.1-2.7 0-53.5-27.5-96.9-61.4-96.9-28.1 0-51.8 29.7-59.1 70.4l0.9-0.3c-157.8 50.1-271.9 195.3-271.9 366.7 0 103.1 41.3 196.8 108.6 265.9"
fill="#29ABE2" p-id="9672"></path>
<path
d="M793.9 889.3v-1.6h-627l0.2 0.2h-12.3l7.9-1.6C77.8 798.3 31 683.2 31 562.1c0-63.7 12.7-125.4 37.8-183.5C93 322.5 127.7 272 171.9 228.7c44.2-43.3 95.6-77.3 152.9-101C384.1 103 447.1 90.6 512 90.6s127.9 12.5 187.2 37.1c57.3 23.7 108.7 57.7 152.9 101s78.9 93.7 103.1 149.9c25.1 58.1 37.8 119.9 37.8 183.5 0 121.8-47.2 237.4-132.9 325.4l-0.6-0.6-0.1 0.8c-0.4-0.1-0.9-0.1-1.3-0.1h-62.5l-1.7 1.7zM512 92.6c-264.1 0-479 210.6-479 469.5 0 121.1 46.9 236 132 323.6 0.4-0.1 0.8-0.1 1.3-0.1h60.3c-69.1-71.9-107.1-165.9-107.1-264.8 0-83.3 26.6-162.6 77-229.4 24.2-32.1 53.3-60.3 86.3-83.7 33-23.4 69.3-41.6 107.9-54 7.7-41.6 32.3-70.6 59.9-70.6 30.6 0 56.1 34.7 61.4 80.4 5.3-45.6 30.9-80.4 61.4-80.4 27.7 0 52.3 29 59.9 70.6 38.6 12.4 74.9 30.6 107.9 54s62.1 51.6 86.3 83.7c50.4 66.8 77 146.1 77 229.4 0 98.9-38 192.8-107.1 264.8H858c0.3 0 0.7 0 1 0.1 85.1-87.6 132-202.6 132-323.6 0-258.9-214.9-469.5-479-469.5z m-282.6 793h565.2c69.6-71.7 107.9-165.7 107.9-264.8 0-166.9-108.5-313.6-270.1-365.4l-1.1-0.4 0.2-0.6c-7.4-40.9-31.3-69.5-58.1-69.5-33.1 0-60.2 42.8-60.4 95.4v0.6c0 0.9 0 1.9-0.1 2.8l-2-0.1 0.1-3.2c-0.2-52.6-27.2-95.4-60.4-95.4-26.8 0-50.7 28.6-58.1 69.5l0.2 0.6h-0.1l-0.8 0.3c-161.7 51.7-270.4 198.5-270.4 365.4 0.1 99.1 38.4 193.1 108 264.8z"
p-id="9673"></path>
<path
d="M794.4 888.1v-0.9H165.7l0.2 0.2h-6.2l4-0.8c-85.2-88-132.2-203.2-132.2-324.5 0-63.6 12.7-125.3 37.8-183.3 24.2-56.1 58.8-106.5 103-149.7 44.1-43.3 95.5-77.2 152.7-100.9 59.2-24.6 122.2-37 187-37s127.8 12.5 187 37c57.2 23.7 108.6 57.7 152.7 100.9 44.1 43.3 78.8 93.6 103 149.7 25.1 58.1 37.8 119.8 37.8 183.3 0 121.7-47.2 237.1-132.8 325.1l-0.2-0.2-0.1 0.3c-0.5-0.1-0.9-0.1-1.4-0.1h-62.8l-0.8 0.9zM512 92.1c-264.4 0-479.5 210.8-479.5 470 0 121.3 47 236.4 132.3 324.2 0.5-0.1 1-0.1 1.4-0.1h61.5C158.3 814.2 120 720 120 620.9c0-83.2 26.6-162.4 76.9-229.1 24.2-32.1 53.2-60.2 86.2-83.6 33.1-23.5 69.4-41.6 108-54 7.6-41.5 32-70.5 59.5-70.5 31.5 0 57.5 37.1 61.4 85 3.9-47.8 30-85 61.4-85 27.5 0 51.9 29 59.5 70.5 38.6 12.4 75 30.6 108 54s62 51.5 86.2 83.6c50.3 66.7 76.9 145.9 76.9 229.1 0 99.2-38.3 193.3-107.8 265.3H858c0.4 0 0.8 0 1.2 0.1 85.3-87.8 132.3-202.9 132.3-324.1 0-259.3-215.1-470.1-479.5-470.1z m-282.8 794h565.7c69.8-71.8 108.2-166 108.2-265.3 0-167.4-109-314.4-271.2-366.1l-0.3-0.1h-0.1l0.3-1h0.1c-7.6-40.7-31.5-69.1-58.4-69.1-33.4 0-60.7 43-60.9 95.9v0.6c0 0.9 0 1.8-0.1 2.7l-1-0.1 0.1-3.2c-0.2-52.9-27.4-95.9-60.9-95.9-26.9 0-50.8 28.4-58.4 69.1h0.1l0.3 1h-0.1l-0.7 0.2c-162 51.8-270.8 198.7-270.8 366-0.1 99.3 38.3 193.5 108.1 265.3z"
p-id="9674"></path>
<path
d="M793.4 890.5v-2.4H229.2l-0.5 0.4-0.4-0.4h-60.2l0.2 0.2h-18.4l11.8-2.4C77.1 798 30.5 683 30.5 562.1c0-63.7 12.7-125.5 37.8-183.7 24.3-56.2 59-106.7 103.2-150s95.7-77.4 153-101.1C384 102.6 447 90.1 512 90.1s128 12.5 187.4 37.1c57.3 23.8 108.8 57.8 153 101.1s78.9 93.8 103.2 150c25.1 58.2 37.8 120 37.8 183.7 0 121.9-47.3 237.6-133.1 325.8l-0.1 0.1-0.1 0.4h-0.3l-0.2 0.2-0.3-0.3h-0.2c-0.4-0.1-0.8-0.1-1.2-0.1h-62.3l-2.2 2.4zM512 93.1c-263.8 0-478.5 210.4-478.5 469 0 120.9 46.8 235.6 131.7 323.1 0.4 0 0.7-0.1 1.1-0.1h59.1C156.8 813.2 119 719.5 119 620.9c0-83.4 26.7-162.9 77.1-229.7 24.3-32.2 53.3-60.4 86.4-83.9 33-23.4 69.2-41.6 107.7-54 7.8-41.7 32.6-70.7 60.4-70.7 29.6 0 55.1 32.5 61.4 77 6.3-44.5 31.8-77 61.4-77 27.8 0 52.6 29 60.4 70.7 38.5 12.4 74.8 30.6 107.7 54 33.1 23.5 62.1 51.7 86.4 83.9C878.4 458 905 537.5 905 620.9c0 98.6-37.8 192.4-106.4 264.3h60.1v-0.3l0.2 0.2c84.8-87.5 131.5-202.2 131.5-323 0.1-258.6-214.6-469-478.4-469z m-282.4 792h564.8C863.8 813.5 902 719.7 902 620.9c0-166.9-108.7-313.6-270.5-365.1l-1.2-0.4 0.2-1 0.3-0.9c-7.6-40-31.1-67.9-57.4-67.9-32.8 0-59.7 42.6-59.9 94.9v0.6c0 1 0 1.9-0.1 2.8l-0.1 1-2.9-0.2 0.1-4.2c-0.2-52.3-27.1-94.9-59.9-94.9-26.2 0-49.8 27.9-57.4 67.9l0.6 1.8-1.7 0.5C230.5 307.5 122 454.2 122 620.9c0 98.8 38.2 192.6 107.6 264.2z"
p-id="9675"></path>
<path d="M150.669 350.56l0.602-1.908 261.668 82.595-0.602 1.907z" p-id="9676"></path>
<path
d="M413 434.4l-1-0.3-262.6-82.9 1.2-3.8 1 0.3 262.6 82.9zM150.73 616.036l261.683-82.235 0.6 1.908-261.682 82.235z"
p-id="9677"></path>
<path d="M150.6 619.2l-1.2-3.8 1-0.3L413 532.5l1.2 3.8-1 0.3-262.6 82.6z m1.3-2.5L411.7 535l-259.8 81.7z"
p-id="9678">
</path>
<path d="M151 482.4h261.7v2H151z" p-id="9679"></path>
<path d="M413.6 485.4H150v-4h263.7v4z m-261.6-2h259.7H152z" p-id="9680"></path>
<path d="M610.563 431.223l261.695-82.54 0.602 1.907-261.695 82.54z" p-id="9681"></path>
<path
d="M610.5 434.4l-1.2-3.8 1-0.3 262.6-82.9 1.2 3.8-1 0.3zM610.535 535.683l0.6-1.908 261.655 82.29-0.6 1.908z"
p-id="9682"></path>
<path d="M872.9 619.2l-1-0.3-262.6-82.6 1.2-3.8 1 0.3 262.6 82.6-1.2 3.8zM611.8 535l259.8 81.7L611.8 535z"
p-id="9683"></path>
<path d="M610.9 482.4h261.7v2H610.9z" p-id="9684"></path>
<path d="M873.5 485.4H609.9v-4h263.7v4z m-261.6-2h259.7-259.7z" p-id="9685"></path>
</svg> </div>
<div class="p">复制成功啦~</div>
</div>
<div id="coordinate"></div>
<div id="copyButton" onclick="copyDivContent()"><svg t="1711417073380" class="icon" viewBox="0 0 1024 1024"
version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6485" width="50" height="50">
<path
d="M930.36 157v504.16a62.9 62.9 0 0 1-62.83 63h-83.17V350.19c0-60.7-49.28-110.07-109.85-110.07H300.36V157a62.88 62.88 0 0 1 62.93-62.83h504.15A62.92 62.92 0 0 1 930.36 157z"
fill="#ffffff" p-id="6486"></path>
<path
d="M674.36 300.12h-530a50 50 0 0 0-50 50v530a50 50 0 0 0 50 50h530a50 50 0 0 0 50-50v-530a50 50 0 0 0-50-50z m-132.48 435H276.52c-15.81 0-29.37-12-30.51-27.76a30 30 0 0 1 29.92-32.24h265.35c15.81 0 29.37 12 30.51 27.76a30 30 0 0 1-29.92 32.24z m0-180H276.52c-15.81 0-29.37-12-30.51-27.76a30 30 0 0 1 29.92-32.24h265.35c15.81 0 29.37 12 30.51 27.76a30 30 0 0 1-29.92 32.24z"
fill="#ffffff" p-id="6487"></path>
</svg></div>
</div>
</div>
</div>
<div id="mapDiv"></div>
</body>
<script type="text/javascript" src="http://api.tianditu.gov.cn/api?v=4.0&tk=您的密钥"></script>
<script>
var map;
var zoom = 12;
var geocoder;
var myDiv = document.getElementById('coordinate');
var mycopy = document.getElementById('copy');
function onLoad() {
//初始化地图对象
map = new T.Map("mapDiv");
//设置显示地图的中心点和级别
map.centerAndZoom(new T.LngLat(116.40969, 39.89945), zoom);
var cp = new T.CoordinatePickup(map, { callback: getLngLat })
cp.addEvent();
//创建对象
geocoder = new T.Geocoder();
}
function getLngLat(lnglat) {
document.getElementById("coordinate").innerHTML = lnglat.lng.toFixed(6) + "," + lnglat.lat.toFixed(6);
}
function searchResult(result) {
if (result.getStatus() == 0) {
map.panTo(result.getLocationPoint(), 16);
// console.log(result.getLocationPoint())
var newContent = result.getLocationPoint().lng + ',' + result.getLocationPoint().lat;
myDiv.innerHTML = newContent;
// console.log(newContent)
//创建标注对象
var marker = new T.Marker(result.getLocationPoint());
//向地图上添加标注
map.addOverLay(marker);
} else {
alert("地址不正确的为!!!");
}
}
function search() {
map.clearOverLays();
geocoder.getPoint(document.getElementById("searchPoint").value, searchResult);
}
// 获取div内容
function getDivContent() {
return document.getElementById('coordinate').textContent || document.getElementById('coordinate').innerText;
}
// 复制到剪贴板的函数
function copyToClipboard(text) {
// 检查当前环境是否支持clipboard API
if (navigator.clipboard) {
// 写入剪贴板
navigator.clipboard.writeText(text)
.then(() => {
mycopy.classList.add('on');
let timerId = setTimeout(function () {
mycopy.classList.remove('on');
}, 4000);
console.log('Text copied to clipboard121');
})
.catch(err => {
console.error('Failed to copy: ', err);
});
} else {
// 对于不支持此API的浏览器,可以采用其他方式如创建隐藏textarea来模拟复制操作
var textarea = document.createElement('textarea');
textarea.value = text;
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
mycopy.classList.add('on');
let timerId = setTimeout(function () {
mycopy.classList.remove('on');
}, 4000);
console.log('Text copied to clipboard');
} catch (err) {
console.error('Unable to copy', err);
} finally {
document.body.removeChild(textarea);
}
}
}
// 点击div时复制其内容
function copyDivContent() {
var textToCopy = getDivContent();
if (textToCopy) {
copyToClipboard(textToCopy);
}
}
</script>
</html>