本文主要实现两部分内容:
1、实现WGS84坐标到高德火星坐标的转换;中间设计调取高德提供的WEb 坐标转换API,将返回的json转为字符串,然后解析字符串
2、实现读取EXCEl的内容并且写EXCEl。实现读写!
这里添加一下高德坐标转换的页面
http://lbs.amap.com/api/webservice/guide/api/
一下是源码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Reflection;
using Microsoft.Office.Interop.Excel;
namespace 高德坐标转换
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//string url = "http://restapi.amap.com/v3/assistant/coordinate/convert?key=07c9d2e7c963daed09de8ca3e43bcc7c&locations=116.481499,39.990475&coordsys=gps";
string a = "116.481499";
string b = "39.990475";
MessageBox.Show(Tran(a,b)[0].ToString());
MessageBox.Show(Tran(a, b)[1].ToString());
}
private string[] Tran(string x, string y)
{
string url = "http://restapi.amap.com/v3/assistant/coordinate/convert?key=07c9d2e7c963daed09de8ca3e43bcc7c&locations="+x+","+y+"&coordsys=gps";
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.Htt