资源简介
该代码实现了对 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个程序
- 下一篇:小程序开发源码酒店
相关资源
- New fixed point theorems of e-concave-convex m
- checkpoint的snmp及syslog配置.doc
- Symantec AntiVirus for Microsoft SharePoint产品
- 一张精美的PowerPoint甘特图模板.rar
- POI中文帮助文档附带api手册.zip
- PowerPoint2000支持库
- Existence of positive solutions for singular h
- D 6 R 4曲率校正,模块化图形函数和
- 狭义相对论变形中相互作用局部的时
- 使用半整数自旋发生器扩展Poinca
- Anti-de Sitter空间和AdS / CFT的两个P
- 从Poincaré代数的闭合中得
- Centering Conditions for the Poincar‘
- 一回路的κ-Poincaré不变
- Kubo-Martin-Schwinger权重的κ-Poin
- 由κ-Poincarér矩阵产生
- SPOI标记猪脂肪干细胞向成骨细胞分化
- 番茄工作法(pomotime)PowerPoint.rar
- poi 动态修改docx窗体域内容,并存为
- 2019版本poi 2019高德poi 2019百度poi
- 航迹大师 waypoint master 2.3
- 长沙市POI数据.zip
- case in point 中文版
- 浮点数IEEE754标准
- SpoilerAL汉化版
- Modeling of rapeseed at maturity stage using 3
- .net导入导出Excel文件
- poi导出导入封装使用注解建立实体与
- (改进版本)利用poi读取word模板文件
- η变形的AdS2×S2×T6超弦的P
评论
共有 条评论