Tuesday, September 6, 2011

如何在Mac OSX上,讀取台北市政府放出來的地圖資料

台北市政府把一些地圖資訊,用shapefile的格式放出來了,玩了兩天,總算把這檔案開了起來。為了造福後人,就把過程寫下來了

1. 安裝QGIS
2. 下載里界圖,並解壓縮

開起QGIS,從選單上選 Layer -> Add Vector Layer -> Encoding = BIG5, Dataset = 解開的檔案



一開始開啟的檔案,並沒有把文字資料一起顯示出來,所以,接著我們要把這資料打開來。從Layers中點選『台北市里界圖』並選Labels,Display labels勾起來,然後Field選PTVAME,然後按OK



這樣,文字資料就跑出來了



接下來的兩週,我會把Geometric search的功能,加到我公司的產品中,讓你直接能後匯入多邊型的地理資料,並且能夠做一些簡單的搜尋功能

Sunday, September 4, 2011

關於北市府開放資料授權方式的一些想法

在某些人士運作之下,中華民國政府及台北市政府,示範性值的,開放了一些資料出來,開放出來的資料及品質,大家自己去看就好,我懶得去說了。

我比較有意見的是,這些開放資料的授權方式。目前北市府網站已故障,找不到合約。跟據我的印象,第二條是寫『資料的使用必須要就有公益性的部份,提供免費版』 很明顯,這個條約是個蠢左派公務員定的,當大家都是喝空氣過活當神仙。

公益性,是個很好打嘴砲的東西,但是,什麼叫公益性質呢?簡單說來就是,『當一個人把自己的勞力或財產,無償供應其它人使用』就變成有公益性;例如,我無償打掃公司外路口的走道,叫有公益性,我無償把土地借出來讓大家開會,也叫有公益性,問題在於,若是那一天我開始收費,同一個行為就變成無公益性了。

不知你有看出來這授權問題了嗎?只要有人跳出來說,某程式很多人用不應該收費,那開發商馬上要變成做白工,這種授權方式,會有認真的開發商想跳下去嗎?當然是沒有。

所以我說,這授權方式是蠢左派定的,再者,公益性跟營利並不起衝突阿;若是有衝突,那,負責收集這些資料的公務員,可不可以也不支薪來做事啊。

Thursday, September 1, 2011

Having a good build system is like living in the heaven, and having a bad.....

Having a good build system is like living in the heaven, and having a bad build system is like living in the hell. I am just tired of dealing with all kind of build system. In short, all build systems are either suck or sucks more.

Yesterday, I spent 4 hours to help a coworker to deal with library projects in Android. It wasn't a pleasure experience. Today, I spent another 4 hours to figure out how to configure an integration-test phase in SBT.

Just to save you some time, here is how to do it with SBT's quick configuration DSL, build.sbt.

import sbt._

{
    lazy val IntegrationTest = config("it") extend(Test) extend(Provided) extend(Optional)
    lazy val itSettings: Seq[Project.Setting[_]] =
        inConfig(IntegrationTest)(Defaults.testSettings) ++
        Seq(
             ivyConfigurations += IntegrationTest
        )
    seq(itSettings : _*)
}

That is all you need. The first line in the block defines a new configuration, it. The 'it' configuration extends all the dependencies from 'Test'. And the fifth line exposes this configuration to ivy and sbt.