Archive for August, 2008

GeoServer render OpenStreetMap

Sunday, August 31st, 2008

Now OpenStreetmap covers most euro regions. I am surprised when I am the first saw OpenStreetMap. It looks just fantastic. Actually, in 2007, one of openstreetmap developer gave us a lecture about their ideas. How openstreetmap goings. But at that time, I have no idea about it. It just like copying ideas from wikipedia. Now it is very nice ‘Copying’. Everybody have free and comprehensive spatial information for free.

I would like to compare Google Maps, Microsoft maps or Yahoo maps with OpenStreetMap. I think some other people must be already wrote something about it. There is no need to repeat it again.

Back to today’s point, using Geoserver rendering OpenStreetMap. Honestly, it is not easy to rendering OSM by Geoserver. Because there is no offical OSM SLD file for GeoServer. In the mailinglist there are few people asked whether there is a SLD of OpenStreetMap. I did not find any SLD file of OSM map until last month. One geoserver user wrote a tutorial to teach people how to write Google style SLD. Based on this turtorial, we can easily write an OSM SLD for GeoServer.

Data:

http://t1.hypercube.telascience.org/planet/?C=S;O=A

Tools

GeoServer

PostGIS/PostgreSQL

Useful links:

http://oegeo.wordpress.com/

http://www.perrygeo.net/wordpress/

http://geoserver.org/display/GEOSDOC/Google+Maps+SLD

http://geoserver.org/display/GEOSDOC/Geoserver+and+Google+SLDs

Here I would like to spend sometime to complain about the quality of OSM. You could say OSM it is not perfect datasets. THE ATTRIBUTE TABLE IS A MESS. There is no free lunch. So we still need to adopt to the bad quality datasets.

The prepare job would be setup a GeoServer and a PostGIS. And import OSM map into PostGIS. If you are a beginner of PostGIS or GeoServer or SLD. Then you need time to read some material before continue reading this article.

Something for windows users, I don’t know how did you import osm file into PostGIS. There is a tool osm2pgsql.exe which can easily import osm data to PostGIS. From my experience, this tool is quite nasty. I had two version of datasets. I could not import them to PostGIS by osm2pgsql.exe. Even one of them did been import into database, but it with some other problems. Actually, there are some errors when import it. Anyway, I recommend use LINUX version osm2pgsql.exe to import data. After that, you can back up your database to a backup file. Then restore it on windows PostGIS. It is works fine for me. When you have error with osm2pgsql.exe, please, follow me.

There will be four layers of openstreetmap, road, lines, polygon and points. Here I only used three layers: lines ploygon and points.

Here is some example about how to write lines featuers.

A secondary line with labels

<sld:Rule>
<sld:Name>rule008</sld:Name>
<sld:Title>secondary  trunk</sld:Title>
<sld:Abstract>Abstract</sld:Abstract>
<ogc:Filter>
<ogc:Or>

<ogc:PropertyIsEqualTo>
<ogc:PropertyName>highway</ogc:PropertyName>
<ogc:Literal>secondary</ogc:Literal>
</ogc:PropertyIsEqualTo>

<ogc:PropertyIsEqualTo>
<ogc:PropertyName>highway</ogc:PropertyName>
<ogc:Literal>secondary_link</ogc:Literal>
</ogc:PropertyIsEqualTo>

</ogc:Or>

</ogc:Filter>
<sld:MinScaleDenominator>150000</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>400000</sld:MaxScaleDenominator>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name=”stroke”>
<ogc:Literal>#d69c51</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-linecap”>
<ogc:Literal>butt</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-linejoin”>
<ogc:Literal>miter</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-width”>
<ogc:Literal>5.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-dashoffset”>
<ogc:Literal>0.0</ogc:Literal>
</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name=”stroke”>
<ogc:Literal>#fdbf6f</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-linecap”>
<ogc:Literal>round</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-linejoin”>
<ogc:Literal>round</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-width”>
<ogc:Literal>4.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-dashoffset”>
<ogc:Literal>0.0</ogc:Literal>
</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>

<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>ref</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name=”font-family”>
<ogc:Literal>Lucida Sans</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-size”>
<ogc:Literal>6.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-style”>
<ogc:Literal>normal</ogc:Literal>
</sld:CssParameter>

<sld:CssParameter name=”font-weight”>
<ogc:Literal>bold</ogc:Literal>
</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.5</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill>
<sld:CssParameter name=”fill”>
<ogc:Literal>#fdbf6f</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”fill-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
</sld:Fill>

<sld:VendorOption name=”group”>yes</sld:VendorOption>
<sld:VendorOption name=”spaceAround”>2</sld:VendorOption>

<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource xlink:type=”simple” xlink:href=”secondary_shield3.png”/>
<sld:Format>image/png</sld:Format>
</sld:ExternalGraphic>

<sld:Opacity>
<ogc:Literal>1.0</ogc:Literal>
</sld:Opacity>
<sld:Size>
<ogc:Literal>18.0</ogc:Literal>
</sld:Size>
<sld:Rotation>
<ogc:Literal>0.5</ogc:Literal>
</sld:Rotation>
</sld:Graphic>
</sld:TextSymbolizer>

</sld:Rule>

A railway in Geoserver, you should switch off, “fully SLD schema validator….”


<sld:Rule>
<sld:Name>rule06</sld:Name>
<sld:Title>railway rail</sld:Title>
<sld:Abstract>Abstract</sld:Abstract>
<ogc:Filter>

<ogc:PropertyIsEqualTo>
<ogc:PropertyName>railway</ogc:PropertyName>
<ogc:Literal>rail</ogc:Literal>
</ogc:PropertyIsEqualTo>

</ogc:Filter>
<sld:MinScaleDenominator>150000</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>400000</sld:MaxScaleDenominator>

<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name=”stroke”>
<ogc:Literal>#000000</ogc:Literal>
</sld:CssParameter>

<sld:CssParameter name=”stroke-linejoin”>
<ogc:Literal>round</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-width”>
<ogc:Literal>4.0</ogc:Literal>
</sld:CssParameter>

</sld:Stroke>
</sld:LineSymbolizer>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParameter name=”stroke”>
<ogc:Literal>#ffffff</ogc:Literal>
</sld:CssParameter>

<sld:CssParameter name=”stroke-linejoin”>
<ogc:Literal>round</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-width”>
<ogc:Literal>3.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”stroke-dasharray”>10 10</sld:CssParameter>

</sld:Stroke>
</sld:LineSymbolizer>

<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>name</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name=”font-family”>
<ogc:Literal>Lucida Sans</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-size”>
<ogc:Literal>10.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-style”>
<ogc:Literal>normal</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-weight”>
<ogc:Literal>bold</ogc:Literal>
</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:LinePlacement>
<sld:PerpendicularOffset>
<ogc:Literal>10.0</ogc:Literal>
</sld:PerpendicularOffset>
</sld:LinePlacement>
</sld:LabelPlacement>
<sld:Halo>
<sld:Radius>
<ogc:Literal>2</ogc:Literal>
</sld:Radius>
<sld:Fill>
<sld:CssParameter name=”fill”>#ffffff</sld:CssParameter>
<sld:CssParameter name=”fill-opacity”>1.0</sld:CssParameter>
</sld:Fill>
</sld:Halo>
<sld:Fill>
<sld:CssParameter name=”fill”>
<ogc:Literal>#000000</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”fill-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
</sld:Fill>
<sld:VendorOption name=”spaceAround”>2</sld:VendorOption>
<sld:VendorOption name=”group”>yes</sld:VendorOption>
</sld:TextSymbolizer>

some results

TEST01 TEST04TEST01 TEST04

please, give me a reason to buy Netbook!!

Wednesday, August 20th, 2008

Netbook, everywhere is Netbook. I could not find any reason to buy it. Only one thing of Netbook is attracttive. It is SSD, which could be really fast when you booting system. but SSD for netbooks are so small capacity. There is one more thing attract me. it is LED display , which much better and more expensive than LCD.  On another hand, there are so many reason for not buying it.
no netbook
1. display are small. what you can do for a 7″ or 9″ inch, you want to chat or typing your blog or article. At least you need a big screen to read letters and watch people. even some stupid nuts said, if CPU could be updates, then they can watch HD video or movie on Netbooks. come on, give me a break. I never heard of people want a small HD panel. HD is HD, it is because it is making people watch more details about videos. Netbooks play HD video is not good idea at all.

2. price. if you compare the price of Netbooks with main stream laptop, it is not cheap stuff. Netbook normally start with 300euro, the main stream (with a 15.4″ panel) start at 400euro or 450euro. It is not reasonable to buy a netbook.

3. Keyboard. only if you want to typing only by your left hand or right hand.  It is keyboard is so small. when I see the keyboard, I feel Netbook is just a big PDA.

4. low speed cpu, low storage……etc.

Many people says NetBooks would be a good choice for a second pc at home  or when you travelling.  but it is really not health to use this kind of devices when you at home or travelling. I see all pc producer are going to nuts. from now on, I could not see any market for this product. If I buy next pc or mac, the first thing I would consider is performance.

Hello world!

Wednesday, August 20th, 2008

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!