作者liyih ()
看板Perl
标题Re: [问题] 抓取字串
时间Fri Jul 23 01:02:32 2010
※ 引述《sask (sask)》之铭言:
: 请问各位
: 我有一个变数$xy存了一笔WKT格式的字串 如下:
: polygon((121.1234567 23.2345678, 121.7654321 23.8765432,
: 121.3456789 23.9876543, 121.5678901 23.1098765 .........
: 我想取出这个字串里的第二笔座标并且存在两个变数中
: 也就是$x=121.7654321 $y=23.8765432
: 请问要怎麽处理呢??
: 我翻书翻了很久 还是不太知道怎麽做
: 感谢大家~~
您可以 google 搜寻一下关键字:wkt、well-known text
Well-Known Text format
*
http://en.wikipedia.org/wiki/Well-known_text
*
http://geoapi.sourceforge.net/2.0/javadoc/org/opengis/referencing/
doc-files/WKT.html
这对於您要 parse 这个格式的资料应该有帮助。
另外 cpan 中有个 Geo::WKT 的模组可以使用,您可以参考当中
parse_wkt_polygon 的程式码。
*
http://cpansearch.perl.org/src/MARKOV/Geo-WKT-0.03/lib/Geo/WKT.pm
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 211.74.246.253
※ 编辑: liyih 来自: 211.74.246.253 (07/23 01:02)
1F:推 sask:感谢~ 07/23 10:13