资源简介
该代码实现了对 googlemap网站的查询返回的包含POI信息的文本内容解析功能,可以提取创poi的名称,地址,电话,经纬度等信息。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GoogleParse
{
public class googlepoi {
public string oid = ““;
public string classaddress = ““;
public string address = ““;
public string fname = ““;
public string name = ““;
public string category = ““;
public string phone = ““;
public string website = ““;
public string lat = ““;
public string lon = ““;
}
public class pairs
{
public int p1 = -1 p2 = -1;
public pairs(int _p1 int _p2)
{
this.p1 = _p1; this.p2 = _p2;
}
}
public class googlepoi_parser
{
public googlepoi_parser() { }
static public List GetItems(string str) {
List pois = new List();
pairs p = getparis(str “{“ “}“ 0);
// Console.WriteLine(p.p1+““+p.p2);
string mstr = str.Substring(p.p1 p.p2 - p.p1 + 1);
int pos = getpos(str “[“ p.p2 3);
p = getparis(str “[“ “]“ pos);
string itemstr = ““;
//获取数据列表的内容
mstr = str.Substring(p.p1 p.p2 - p.p1 + 1);
pos = 1;
do
{
p = getparis(mstr “[“ “]“ pos);
itemstr = mstr.Substring(p.p1 p.p2 - p.p1 + 1);
// Console.WriteLine(itemstr);
googlepoi poi= parseItem(itemstr);
if (poi != null) pois.Add(poi);
pos = getpos(mstr “[“ p.p2 1);
if (pos == -1) break;
} while (true);
return pois;
}
///
/// 解析一个poi的内容 //实体id,分级地址,全地址,带地址名称,名称,类型,联系电话,联系网站,经纬度,
///
///
static googlepoi parseItem(string itemstr)
{
googlepoi poi = null;
int pos = getpos(itemstr “[“ 1 1);
pairs p = getparis(itemstr “[“ “]“ pos);
List items = new List();
//XXXXXXXXX
string mstr = itemstr.Substring(p.p1 + 1 p.p2 - p.p1 - 1);
int p0 = 0;
int gap = 1;
do
{
if (mstr.Substring(p0 1) == “[“)
{
p = getparis(mstr “[“ “]“ p0);
pos = getpos(mstr ““ p.p2 1);
gap = 1;
}
else if (mstr.Substring(p0).StartsWith(“\\\““))
{
pos = getpos(mstr “\\\““ p0 1);
gap = 3;
}
else {
pos = getpos(mstr ““ p0 1);
gap = 1;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-02-01 11:12 googlepoiparse\
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\.vs\
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\.vs\ConsoleApplication1\
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\.vs\ConsoleApplication1\v14\
文件 42496 2016-02-01 11:25 googlepoiparse\ConsoleApplication1\.vs\ConsoleApplication1\v14\.suo
目录 0 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\
文件 1024 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1.sln
文件 189 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\App.config
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\
目录 0 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\
文件 25350 2016-01-31 00:49 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\china.txt
文件 8192 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
文件 189 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe.config
文件 19968 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb
文件 22696 2016-02-01 11:13 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe
文件 189 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.config
文件 490 2014-01-14 13:31 googlepoiparse\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.manifest
文件 25350 2016-01-31 00:49 googlepoiparse\ConsoleApplication1\ConsoleApplication1\china.txt
文件 2745 2016-02-01 10:26 googlepoiparse\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj
文件 9367 2016-02-01 11:10 googlepoiparse\ConsoleApplication1\ConsoleApplication1\googlepoi_parser.cs
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\
目录 0 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\
文件 542 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csproj.FileListAbsolute.txt
文件 8192 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe
文件 19968 2016-02-01 11:14 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.pdb
文件 6842 2016-02-01 10:17 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
目录 0 2016-01-29 11:19 googlepoiparse\ConsoleApplication1\ConsoleApplication1\obj\Debug\TempPE\
............此处省略3个文件信息
- 上一篇:台达PLC44个程序
- 下一篇:小程序开发源码酒店
相关资源
- 长沙市POI数据.zip
- case in point 中文版
- 浮点数IEEE754标准
- SpoilerAL汉化版
- Modeling of rapeseed at maturity stage using 3
- .net导入导出Excel文件
- poi导出导入封装使用注解建立实体与
- (改进版本)利用poi读取word模板文件
- η变形的AdS2×S2×T6超弦的P
- η变形对称空间sigma模型的Poisson-L
- NPOI2.2版本
- 关于泊松点过程的生成方法-Report1_P
- 地形点云.pcd
- 使用POI技术读取Excel中数据,比对,并
- poi读取xlsx和xls
- 北京市POI商业数据
- SubPoints.rar
- NPOI最新版2.4.1
- NPOI使用手册
- openGL实现三维点云显示
- The Computational Neurobiology of Reaching and
- NPOI2.0官方版本
- 建筑物的地面扫描点云数据
- 原创-NPOI操作Word文档中的Bookmark标签以
- 实训项目四PowerPoint 综合应用答案.z
- 用图表说话-powerpoint高级教程
- NPOI2.0 dll
- NPOI_2.2全套DLL
- NPOI创建docx常用操作
- 一个兼容word2007的NPOI插入图表
评论
共有 条评论