<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ZPC的博客</title>
	<atom:link href="http://zpc.im/feed" rel="self" type="application/rss+xml" />
	<link>http://zpc.im</link>
	<description>Simple  Is  Powerful.</description>
	<lastBuildDate>Fri, 18 May 2012 07:00:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>网易评论一则</title>
		<link>http://zpc.im/2012/05/f22a-raptor.html</link>
		<comments>http://zpc.im/2012/05/f22a-raptor.html#comments</comments>
		<pubDate>Fri, 18 May 2012 05:37:07 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[PC&网络]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1739</guid>
		<description><![CDATA[网易图集：美国空军公开F-22A猛禽部队空中加油训练酷照 热门评论一条： 拆迁队陆政委 [网易福建省泉州市网友]：2012-05-18 10:03:38 发表 ★★★★★★★★★★============================= ★★★★★★★★★★============================= ★★★★★★★★★★============================= ★★★★★★★★★★============================= ★★★★★★★★★★============================= ============================================= ============================================= ============================================= ============================================= 暂无相关日志]]></description>
			<content:encoded><![CDATA[<p>网易图集：<a href="http://war.163.com/photoview/4T8E0001/23597.html" target="_blank">美国空军公开F-22A猛禽部队空中加油训练酷照</a></p>
<p>热门评论一条：</p>
<blockquote><p>拆迁队陆政委 [网易福建省泉州市网友]：2012-05-18 10:03:38 发表</p>
<p>★★★★★★★★★★=============================<br />
★★★★★★★★★★=============================<br />
★★★★★★★★★★=============================<br />
★★★★★★★★★★=============================<br />
★★★★★★★★★★=============================<br />
=============================================<br />
=============================================<br />
=============================================<br />
=============================================</p></blockquote>
<ul class="related_post"><li>暂无相关日志</li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/05/f22a-raptor.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为Amazon EC2 Instance 设置允许ping</title>
		<link>http://zpc.im/2012/04/enable-ping-for-amazon-ec2-instance.html</link>
		<comments>http://zpc.im/2012/04/enable-ping-for-amazon-ec2-instance.html#comments</comments>
		<pubDate>Sun, 29 Apr 2012 18:35:31 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[PC&网络]]></category>
		<category><![CDATA[Amazon EC2]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1731</guid>
		<description><![CDATA[Amazon EC2 的instance 默认是不允许ping 的，要想允许ping，简单几步就可以了—— 登录AWS Management Console， 选择EC2选项卡； 在左侧导航条中选择NETWORK &#38; SECURITY &#8211; Security Groups； 点选你的Security Groups，下方切换到Inbound 选项卡； Create a new rule 选择: Custom ICMP rule Type选择: Echo request Source默认: 0.0.0.0/0  （这样允许所有的ip，也可以指定ip或ip段） 欢迎使用 WordPress 3.3.1]]></description>
			<content:encoded><![CDATA[<p>Amazon EC2 的instance 默认是不允许ping 的，要想允许ping，简单几步就可以了——</p>
<ol>
<li>登录AWS Management Console， 选择EC2选项卡；</li>
<li>在左侧导航条中选择NETWORK &amp; SECURITY &#8211; Security Groups；</li>
<li>点选你的Security Groups，下方切换到Inbound 选项卡；</li>
<li>Create a new rule 选择: Custom ICMP rule<br />
Type选择: Echo request<br />
Source默认: 0.0.0.0/0  （这样允许所有的ip，也可以指定ip或ip段）</li>
</ol>
<ul class="related_post"><li><a href="http://zpc.im/2012/03/welcome-to-the-wordpress-3-3-1.html" title="欢迎使用 WordPress 3.3.1">欢迎使用 WordPress 3.3.1</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/04/enable-ping-for-amazon-ec2-instance.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>github 杂乱笔记</title>
		<link>http://zpc.im/2012/04/github-notes.html</link>
		<comments>http://zpc.im/2012/04/github-notes.html#comments</comments>
		<pubDate>Tue, 03 Apr 2012 07:35:45 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1716</guid>
		<description><![CDATA[创建你的 Blog 仓库 username(请确保跟你的账号名相同).github.com: 初始化仓库、提交并push到Github:  获取最新版本： 如果提示类似 “To git@github.com:username/username.github.com.git ! [rejected] master -&#62; master (non-fast-forward) error: failed to push some refs to &#8216;git@github.com:username/username.github.com.git&#8217; To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. &#8216;git pull&#8217;) before pushing again. See the &#8216;Note about fast-forwards&#8217; section of &#8216;git push &#8211;help&#8217; for details.” [...]]]></description>
			<content:encoded><![CDATA[<p>创建你的 Blog 仓库 <span style="color: #ff0000;">username</span>(请确保跟你的账号名相同).github.com:</p>
<pre class="brush: plain; title: ; notranslate">$ mkdir username.github.com
$ cd username.github.com</pre>
<p>初始化仓库、提交并push到Github:</p>
<pre class="brush: plain; title: ; notranslate">$ git init
$ git add .
$ git commit -a -m 'init commit.'
$ git remote add origin git@github.com:username/username.github.com
$ git push origin master</pre>
<p><span id="more-1716"></span> 获取最新版本：</p>
<pre class="brush: plain; title: ; notranslate">$ git pull origin master</pre>
<p>如果提示类似<br />
“To git@github.com:<span style="color: #ff0000;">username</span>/<span style="color: #ff0000;">username</span>.github.com.git ! [rejected] master -&gt; master (non-fast-forward)<br />
error: failed to push some refs to &#8216;git@github.com:<span style="color: #ff0000;">username</span>/<span style="color: #ff0000;">username</span>.github.com.git&#8217;<br />
To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. &#8216;git pull&#8217;) before pushing again.<br />
See the &#8216;Note about fast-forwards&#8217; section of &#8216;git push &#8211;help&#8217; for details.”<br />
<strong></strong></p>
<p>这时应该先获取最新版本，编辑冲突，然后提交：</p>
<pre class="brush: plain; title: ; notranslate">git pull origin master
git commit -am &quot;update ..&quot;
git push origin master</pre>
<ul class="related_post"><li>暂无相关日志</li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/04/github-notes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]java split(“.”);注意事项</title>
		<link>http://zpc.im/2012/03/java-split.html</link>
		<comments>http://zpc.im/2012/03/java-split.html#comments</comments>
		<pubDate>Thu, 29 Mar 2012 09:31:55 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1709</guid>
		<description><![CDATA[如字符串：http://www.vvcc.abc.com:8080/ ，以“.”分割为字符串数组时，方法如下： 必须经过转义后才能分割，单纯的以domainNam.split(“.”);分割时，结构字符串数组长度为0。 [转]计算java程序运行时间将Flex Builder 3制作成Eclipse插件版]]></description>
			<content:encoded><![CDATA[<p>如字符串：http://www.vvcc.abc.com:8080/ ，以“.”分割为字符串数组时，方法如下：</p>
<pre class="brush: java; title: ; notranslate">String domainNam=&quot;http://elgoog.info/&quot;;
String[] splitStr = domainNam.split(&quot;\\.&quot;);</pre>
<p>必须经过转义后才能分割，单纯的以domainNam.split(“.”);分割时，结构字符串数组长度为0。</p>
<ul class="related_post"><li><a href="http://zpc.im/2012/03/java-program-running-time.html" title="[转]计算java程序运行时间">[转]计算java程序运行时间</a></li><li><a href="http://zpc.im/2011/01/flex-builder-3-eclipse.html" title="将Flex Builder 3制作成Eclipse插件版">将Flex Builder 3制作成Eclipse插件版</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/java-split.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>几个常用的Linux 命令</title>
		<link>http://zpc.im/2012/03/linux-commands.html</link>
		<comments>http://zpc.im/2012/03/linux-commands.html#comments</comments>
		<pubDate>Tue, 27 Mar 2012 07:25:57 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[PC&网络]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1707</guid>
		<description><![CDATA[整理了常用到的几个linux 命令。 一、复制(cp) （1）将/root/目录下的kwx.gd.gif 复制到/wwwroot 目录中，并显示过程（-v） cp -v kwx.gd.gif /wwwroot/ （2）将/root/kwx.gif 复制 一份名叫kwxgd.gif 的副本，并显示过程。 cp -v kwx.gif kwxgd.gif #用法 cp -v（显示过程）（空格） 源文件或文件夹（空格）目标文件或文件夹 二、删除(rm) （1）删除目录/文件夹 直接rm就可以了，不过要加两个参数-rf 即：rm -rf   目录名字 -r 就是向下递归，不管有多少级目录，一并删除 -f 就是直接强行删除，不作任何提示的意思 删除文件夹实例： rm -rf /var/log/httpd/access 将会删除/var/log/httpd/access目录以及其下所有文件、文件夹 需要提醒的是：使用这个rm -rf的时候一定要格外小心，linux没有回收站的 当然，rm还有更多的其他参数和用法，man rm就可以查看了 （2）删除文件 rm -f /var/log/httpd/access.log 将会强制删除/var/log/httpd/access.log这个文件 三、重命名(mv) 将一个名为abc的文件重命名为123就可以这样来写： mv abc 123 但是要注意的是，如果当前目录下也有个123的文件的话，我们的这个文件是会将它覆盖的。 四、移动(mv) 这里的需求是某文件夹中的文件上移一级目录，实际的场景是解压之后出现类似/webroot/wordpress/&#8230;这样的重复目录。 方法很简单， [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>整理了常用到的几个linux 命令。</p></blockquote>
<h4>一、复制(cp)</h4>
<p>（1）将/root/目录下的kwx.gd.gif 复制到/wwwroot 目录中，并显示过程（-v）</p>
<blockquote>
<pre lang="bash">cp -v kwx.gd.gif /wwwroot/</pre>
</blockquote>
<p>（2）将/root/kwx.gif 复制 一份名叫kwxgd.gif 的副本，并显示过程。</p>
<blockquote>
<pre lang="bash">cp -v kwx.gif kwxgd.gif
#用法 cp -v（显示过程）（空格） 源文件或文件夹（空格）目标文件或文件夹</pre>
</blockquote>
<p><span id="more-1707"></span></p>
<h4 lang="bash">二、删除(rm)</h4>
<p>（1）删除目录/文件夹</p>
<p>直接rm就可以了，不过要加两个参数-rf 即：rm -rf   目录名字<br />
-r 就是向下递归，不管有多少级目录，一并删除<br />
-f 就是直接强行删除，不作任何提示的意思</p>
<p>删除文件夹实例：</p>
<blockquote>
<div><code id="code">rm -rf /var/log/httpd/access</code></div>
</blockquote>
<p>将会删除/var/log/httpd/access目录以及其下所有文件、文件夹</p>
<p>需要提醒的是：使用这个rm -rf的时候一定要格外小心，linux没有回收站的</p>
<p>当然，rm还有更多的其他参数和用法，man rm就可以查看了</p>
<p>（2）删除文件</p>
<blockquote>
<div><code id="code1">rm -f /var/log/httpd/access.log</code></div>
</blockquote>
<p>将会强制删除/var/log/httpd/access.log这个文件</p>
<h4>三、重命名(mv)</h4>
<p>将一个名为abc的文件重命名为123就可以这样来写：</p>
<blockquote><p>mv abc 123</p></blockquote>
<p>但是要注意的是，如果当前目录下也有个123的文件的话，我们的这个文件是会将它覆盖的。</p>
<h4 lang="bash">四、移动(mv)</h4>
<p>这里的需求是某文件夹中的文件上移一级目录，实际的场景是解压之后出现类似/webroot/wordpress/&#8230;这样的重复目录。</p>
<p>方法很简单，</p>
<blockquote><p>cd /webroot/wordpress</p>
<p>mv * ..</p></blockquote>
<p>这样就上移了，然后再进入上一级目录，删掉wordpress即可：</p>
<blockquote><p>cd ..</p>
<p>rm -r wordpress</p></blockquote>
<ul class="related_post"><li><a href="http://zpc.im/2012/03/welcome-to-the-wordpress-3-3-1.html" title="欢迎使用 WordPress 3.3.1">欢迎使用 WordPress 3.3.1</a></li><li><a href="http://zpc.im/2010/12/install-archlinux-on-t61.html" title="折腾了一下Archlinux">折腾了一下Archlinux</a></li><li><a href="http://zpc.im/2010/10/solution-of-warning-preg_match-function-preg-match.html" title="warning: preg_match() [function.preg-match] 错误的解决方法">warning: preg_match() [function.preg-match] 错误的解决方法</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/linux-commands.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]计算java程序运行时间</title>
		<link>http://zpc.im/2012/03/java-program-running-time.html</link>
		<comments>http://zpc.im/2012/03/java-program-running-time.html#comments</comments>
		<pubDate>Tue, 27 Mar 2012 01:41:25 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1701</guid>
		<description><![CDATA[两种方法，性质一样。 方法一，以毫秒计时：  方法二，以纳秒计时： [转]java split(“.”);注意事项将Flex Builder 3制作成Eclipse插件版]]></description>
			<content:encoded><![CDATA[<p>两种方法，性质一样。<br />
方法一，以毫秒计时：</p>
<pre class="brush: java; title: ; notranslate">
//伪代码
long startTime=System.currentTimeMillis();   //获取开始时间
doSomeThing();  //测试的代码段
long endTime=System.currentTimeMillis(); //获取结束时间
System.out.println(&quot;程序运行时间： &quot;+(end-start)+&quot;ms&quot;);
</pre>
<p><span id="more-1701"></span> 方法二，以纳秒计时：</p>
<pre class="brush: java; title: ; notranslate">
//伪代码
long startTime=System.nanoTime();   //获取开始时间
doSomeThing();  //测试的代码段
long endTime=System.nanoTime(); //获取结束时间
System.out.println(&quot;程序运行时间： &quot;+(end-start)+&quot;ns&quot;);
</pre>
<ul class="related_post"><li><a href="http://zpc.im/2012/03/java-split.html" title="[转]java split(“.”);注意事项">[转]java split(“.”);注意事项</a></li><li><a href="http://zpc.im/2011/01/flex-builder-3-eclipse.html" title="将Flex Builder 3制作成Eclipse插件版">将Flex Builder 3制作成Eclipse插件版</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/java-program-running-time.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MongoDB:Unclean shutdown detected 解决方法</title>
		<link>http://zpc.im/2012/03/mongodbunclean-shutdown-detected.html</link>
		<comments>http://zpc.im/2012/03/mongodbunclean-shutdown-detected.html#comments</comments>
		<pubDate>Mon, 26 Mar 2012 01:43:44 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[NoSQL]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1692</guid>
		<description><![CDATA[解决方法很简单，一句话： mongod &#8211;repair 如果没有在默认路径安装，则需要指定路径，例如： mongod &#8211;repair &#8211;dbpath D:\MongoDB\data\db 暂无相关日志]]></description>
			<content:encoded><![CDATA[<p>解决方法很简单，一句话：</p>
<blockquote><p>mongod &#8211;repair</p></blockquote>
<p>如果没有在默认路径安装，则需要指定路径，例如：</p>
<blockquote><p>mongod &#8211;repair &#8211;dbpath D:\MongoDB\data\db</p></blockquote>
<ul class="related_post"><li>暂无相关日志</li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/mongodbunclean-shutdown-detected.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]数据库事务必须具备的ACID特性</title>
		<link>http://zpc.im/2012/03/rdbms-acid-features.html</link>
		<comments>http://zpc.im/2012/03/rdbms-acid-features.html#comments</comments>
		<pubDate>Thu, 22 Mar 2012 06:32:43 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1687</guid>
		<description><![CDATA[数据库事务必须具备ACID特性，ACID是Atomic（原子性）、Consistency（一致性）、Isolation（隔离性）和Durability（持久性）的英文缩写。 原子性：指整个数据库事务是不可分割的工作单位。只有使据库中所有的操作执行成功，才算整个事务成功；事务中任何一个SQL 语句执行失败，那么已经执行成功的SQL语句也必须撤销，数据库状态应该退回到执行事务前的状态。 一致性：指数据库事务不能破坏关系数据的完成性以及业务逻辑上的一致性。例如对银行转帐事务，不管事务成功还是失败，应该保证事务结束后ACCOUNTS表中Tom和Jack的存款总额为2000元。 隔离性：指的是在并发环境中，当不同的事务同时操纵相同的数据时，每个事务都有各自的完整数据空间。 持久性：指的是只要事务成功结束，它对数据库所做的更新就必须永久保存下来。即使发生系统崩溃，重新启动数据库系统后，数据库还能恢复到事务成功结束时的状态。 事务的（ACID）特性是由关系数据库管理系统（RDBMS，数据库系统）来实现的。数据库管理系统采用日志来保证事务的原子性、一致性和持久性。日志记录了事务对数据库所做的更新，如果某个事务在执行过程中发生错误，就可以根据日志，撤销事务对数据库已做的更新，使数据库退回到执行事务前的初始状态。 数据库管理系统采用锁机制来实现事务的隔离性。当多个事务同时更新数据库中相同的数据时，只允许持有锁的事务能更新该数据，其他事务必须等待，直到前一个事务释放了锁，其他事务才有机会更新该数据。 暂无相关日志]]></description>
			<content:encoded><![CDATA[<p>数据库事务必须具备ACID特性，ACID是Atomic（原子性）、Consistency（一致性）、Isolation（隔离性）和Durability（持久性）的英文缩写。</p>
<p><span id="more-1687"></span></p>
<ul>
<li><strong>原子性</strong>：指整个数据库事务是不可分割的工作单位。只有使据库中所有的操作执行成功，才算整个事务成功；事务中任何一个SQL 语句执行失败，那么已经执行成功的SQL语句也必须撤销，数据库状态应该退回到执行事务前的状态。</li>
</ul>
<ul>
<li><strong>一致性</strong>：指数据库事务不能破坏关系数据的完成性以及业务逻辑上的一致性。例如对银行转帐事务，不管事务成功还是失败，应该保证事务结束后ACCOUNTS表中Tom和Jack的存款总额为2000元。</li>
</ul>
<ul>
<li><strong>隔离性</strong>：指的是在并发环境中，当不同的事务同时操纵相同的数据时，每个事务都有各自的完整数据空间。</li>
</ul>
<ul>
<li><strong>持久性</strong>：指的是只要事务成功结束，它对数据库所做的更新就必须永久保存下来。即使发生系统崩溃，重新启动数据库系统后，数据库还能恢复到事务成功结束时的状态。</li>
</ul>
<p>事务的（ACID）特性是由关系数据库管理系统（RDBMS，数据库系统）来实现的。数据库管理系统采用日志来保证事务的原子性、一致性和持久性。日志记录了事务对数据库所做的更新，如果某个事务在执行过程中发生错误，就可以根据日志，撤销事务对数据库已做的更新，使数据库退回到执行事务前的初始状态。</p>
<p>数据库管理系统采用锁机制来实现事务的隔离性。当多个事务同时更新数据库中相同的数据时，只允许持有锁的事务能更新该数据，其他事务必须等待，直到前一个事务释放了锁，其他事务才有机会更新该数据。</p>
<ul class="related_post"><li>暂无相关日志</li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/rdbms-acid-features.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]关于GeoJSON</title>
		<link>http://zpc.im/2012/03/about-geojson.html</link>
		<comments>http://zpc.im/2012/03/about-geojson.html#comments</comments>
		<pubDate>Wed, 21 Mar 2012 08:48:43 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[程序猿]]></category>
		<category><![CDATA[GIS]]></category>
		<category><![CDATA[WebGIS]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1679</guid>
		<description><![CDATA[本文转自：http://chuo.me/2009/03/about-geojson 客户端和服务器端通信用XML成本太高，其实GeoJSON 是个很好的解决方案，可以节省很多带宽。就来讨论下GeoJSON 吧，先来看个例子 JSON 是源于javascript 对象，javascript 对象（Object）就是用大括号括起来，中间以键/值的形式表现并用逗号分割，“键”就是对象的属性，而“值”就是该属性的值。javascript 中还有个数组（Array），用中括号括起来，中间只有单个的值并用逗号分割。不管是对象还是数组，其中的值可以是任何元素（对象，数组，字符串，数字等），这就是此中结构的灵活之处。JSON 与XML 很相似，也具有层次结构，是一种轻量级的解决方案。 GeoJSON 保留了JSON 的结构，但增加了一些约束条件： GeoJSON 总是由一个对象组成，这个对象可以为要素集合（featurecollectioni），要素（feature）或者几何体（ geometry）。 GeoJSON 对象必须包含一个type 属性，type  的值可为 “Point”,  “MultiPoint”,  “LineString”,  “MultiLineString”,  “Polygon”,  “MultiPolygon”, “GeometryCollection”,  “Feature”, or “FeatureCollection”。 Geometry 对象是那些type值为 “Point”,  “MultiPoint”,  “LineString”,  “MultiLineString”,  “Polygon”,  “MultiPolygon”,  “GeometryCollection”的GeoJSON 对象。Geometry 对象除了GeometryCollection 外必须包含一个coordinates 属性，其中包含一个点列表。 Feature 对象是type 值为”Feature”的GeoJSON 对象。Feature 对象必须包含一个geometry 属性，其值为一个Geometry 对象。Feature 对象必须含有一个properties 属性，其值可为一个JSON 对象。 GeometryCollection [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>本文转自：<a href="http://chuo.me/2009/03/about-geojson">http://chuo.me/2009/03/about-geojson</a></p></blockquote>
<p>客户端和服务器端通信用XML成本太高，其实GeoJSON 是个很好的解决方案，可以节省很多带宽。就来讨论下GeoJSON 吧，先来看个例子</p>
<p><span id="more-1679"></span></p>
<pre class="brush: jscript; title: ; notranslate">
{ &quot;type&quot;: &quot;FeatureCollection&quot;,
  &quot;features&quot;: [
    { &quot;type&quot;: &quot;Feature&quot;,
      &quot;geometry&quot;: {
&quot;type&quot;: &quot;Point&quot;,
&quot;coordinates&quot;: [102.0, 0.5]
},
      &quot;properties&quot;: {&quot;prop0&quot;: &quot;value0&quot;}
    },
    { &quot;type&quot;: &quot;Feature&quot;,
      &quot;geometry&quot;: {
        &quot;type&quot;: &quot;LineString&quot;,
        &quot;coordinates&quot;: [
          [102.0, 0.0], [103.0, 1.0], [104.0, 0.0],[105.0, 1.0]
        ]
      },
      &quot;properties&quot;: {
        &quot;prop0&quot;: &quot;value0&quot;,
        &quot;prop1&quot;: 0.0
      }
    },
    { &quot;type&quot;: &quot;Feature&quot;,
      &quot;geometry&quot;: {
        &quot;type&quot;: &quot;Polygon&quot;,
        &quot;coordinates&quot;: [
           [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
             [100.0, 1.0], [100.0, 0.0] ]
        ]
      },
      &quot;properties&quot;: {
         &quot;prop0&quot;: &quot;value0&quot;,
         &quot;prop1&quot;: {&quot;this&quot;: &quot;that&quot;}
      }
    }
  ]
}
</pre>
<p>JSON 是源于javascript 对象，javascript 对象（Object）就是用大括号括起来，中间以键/值的形式表现并用逗号分割，“键”就是对象的属性，而“值”就是该属性的值。javascript 中还有个数组（Array），用中括号括起来，中间只有单个的值并用逗号分割。不管是对象还是数组，其中的值可以是任何元素（对象，数组，字符串，数字等），这就是此中结构的灵活之处。JSON 与XML 很相似，也具有层次结构，是一种轻量级的解决方案。</p>
<p>GeoJSON 保留了JSON 的结构，但增加了一些约束条件：</p>
<ol>
<li>GeoJSON 总是由一个对象组成，这个对象可以为要素集合（featurecollectioni），要素（feature）或者几何体（ geometry）。</li>
<li>GeoJSON 对象<strong>必须</strong>包含一个type 属性，type  的值可为 “Point”,  “MultiPoint”,  “LineString”,  “MultiLineString”,  “Polygon”,  “MultiPolygon”, “GeometryCollection”,  “Feature”, or “FeatureCollection”。</li>
<li>Geometry 对象是那些type值为 “Point”,  “MultiPoint”,  “LineString”,  “MultiLineString”,  “Polygon”,  “MultiPolygon”,  “GeometryCollection”的GeoJSON 对象。Geometry 对象除了GeometryCollection 外<strong>必须</strong>包含一个coordinates 属性，其中包含一个点列表。</li>
<li>Feature 对象是type 值为”Feature”的GeoJSON 对象。Feature 对象<strong>必须</strong>包含一个geometry 属性，其值为一个Geometry 对象。Feature 对象<strong>必须</strong>含有一个properties 属性，其值可为一个JSON 对象。</li>
<li>GeometryCollection 对象是type值为”GeometryCollection”的GeoJSON 对象。代表一个几何型集合，与FeatureCollection 不同的是他包含的是Geometry 对象，而不是Feature 对象。GeometryCollection 对象<strong>必须</strong>含有一个geometries 属性，其中包含一组Geometry 对象。</li>
<li>GeoJSON 对象可以有一个”bbox”属性，是”[minx,miny,maxx,maxy]“的结构，他表示了该对象的显示范围。</li>
</ol>
<p>如上面的例子，由大括号括起来的都是GeoJSON 对象，例子中是一个FeatureCollection 对象，他包含了一组Feature 对象，还可以添加这个集合的其他属性。每个Feature 对像都包含一个Geometry 对象和一个属性（JSON 对象），Geometry 对象有所不同，类型不同，coordinates 的数据结构也不同。</p>
<ol>
<li><strong>点</strong>，表示点只需要经度和纬度，用中括号括起来代表一个点坐标。
<pre lang="javascript">{ "type": "Point", "coordinates": [100.0, 0.0] }</pre>
</li>
<li><strong>线</strong>，由一系列点组成，在一组有序点外面再括一个中括号。
<pre lang="javascript">{ "type": "LineString", "coordinates": [ [100.0, 0.0],
                                    [101.0, 1.0] ] }</pre>
</li>
<li><strong>面</strong>，在线的外面再加一个中括号，面列表中的线收尾必须一致。但为什么未免还要加个呢？为了表示面中的洞，第一项表示外围的圈，第二项（如果有的话）表示内围的圈。
<pre lang="javascript">{ "type": "Polygon",
  "coordinates": [
    [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
                   [100.0, 1.0], [100.0, 0.0] ]
    ]
}</pre>
</li>
<li>除了以上还有多点，多线，多面就不多讲了，可以<a href="http://geojson.org/geojson-spec.html">自己去看看</a>。</li>
</ol>
<p>GeoJSON 基本上就这些内容，跟详细的可以去<a href="http://geojson.org/geojson-spec.html">这里</a>。GeoJSON 只是为更好数据通信提供一个标准，现在已有<a href="http://wiki.geojson.org/Users">超过20个项目支持了GeoJSON</a>，包括客户端的和服务器端的，而且<a href="http://www.json.org/json-zh.html">大多数语言都支持JSON</a>。如果你喜欢这种更轻量级的解决方案，那么就加入进来吧。</p>
<p>一个OpenLayers的<a href="http://openlayers.org/dev/examples/vector-formats.html">简单例子</a>：</p>
<blockquote>
<pre lang="javascript">//初始化map
var featurecollection = 'geojson对象';
//获得一个geojson的模板
var geojson = new OpenLayers.Format.GeoJSON();
var layer = new OpenLayers.Layer.Vector();
//用模板来解析这个geojson对象
layer.addFeatures(geojson.read(featurecollection));
map.addLayer(layer);</pre>
</blockquote>
<ul class="related_post"><li><a href="http://zpc.im/2009/11/yesterday-today-tomorrow-the-day-after-tomorrow.html" title="昨天，今天，明天，后天，大后天">昨天，今天，明天，后天，大后天</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/about-geojson.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>又用上了 CDN</title>
		<link>http://zpc.im/2012/03/cdn-again.html</link>
		<comments>http://zpc.im/2012/03/cdn-again.html#comments</comments>
		<pubDate>Fri, 16 Mar 2012 17:39:34 +0000</pubDate>
		<dc:creator>ZPC</dc:creator>
				<category><![CDATA[我的小站]]></category>
		<category><![CDATA[CDN]]></category>

		<guid isPermaLink="false">http://zpc.im/?p=1668</guid>
		<description><![CDATA[好久以前用过CloudFlare 的免费CDN，当时感觉加载速度没用明显提升，所以很快弃用了。 好长时间以来这里访问速度不佳，所以重新配置了CDN，速度确实上来了。表示满意.. IP Blocked]]></description>
			<content:encoded><![CDATA[<p>好久以前用过CloudFlare 的免费CDN，当时感觉加载速度没用明显提升，所以很快弃用了。</p>
<p>好长时间以来这里访问速度不佳，所以重新配置了CDN，速度确实上来了。表示满意..</p>
<ul class="related_post"><li><a href="http://zpc.im/2011/01/ip-blocked.html" title="IP Blocked">IP Blocked</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://zpc.im/2012/03/cdn-again.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

