GeoServer Blog

WhereCampAfrica

Just wanted to give a shout out to a great event for those in Africa or interested in the application of geospatial technologies in Africa.  WhereCampAfrica is an unconference, in the style of BarCamp and WhereCamp, where anyone can show up and present and discuss the (spatial) ideas that excite them.  It should be a great group of people, it runs right after the CGIAR-CSI meeting which I had a good time at least year.  Anyone using GeoServer who can make it out there should definitely attend.  It’s a totally free event.

Read More

GeoServer and the World Glacier Inventory

The most common question I hear from GeoServer users is:  “Who else is using GeoServer?”  So when I find a great example of GeoServer in the wild, I like to pass it along.

The National Snow and Ice Data Center in Boulder, Colorado has a large collection of freely downloadable data, and they are serving this data with KML for viewing in virtual globe environments such as Google Earth.  Buried in their Google Earth Technical Experiments page, they have the World Glacier Inventory, the location and attributes of thousands of glaciers throughout the world.

The NSIDC uses GeoServer to serve this data and to export KML files.  Lisa Ballagh of the NSIDC recently gave a talk at the American Geophysical Union conference in San Francisco, where she described why and how her organization uses GeoServer. This short talk is interesting and well worth a watch, and the images of glaciers as they have changed over time are truly striking.

Check out the NSIDC site, download the WGI data, and view it in Google Earth.  And look for the World Glacier Inventory to be available on Google Maps soon, as part of GeoServer’s integration with Google’s Geo Search.

Read More

GeoServer and OpenStreetMap

OpenStreetMap is a free and editable map of the world.  Founded in 2004 in the United Kingdom in response to the need for a free geospatial data source, it is a community-driven project, allowing for anyone to edit and contribute information.   It has since grown to include data from almost all countries in the world.  The map generated from their data can be used as an alternative to commercial map layers such as those found in Google Maps.  The OpenStreetMap base layer is rendered using Mapnik, however since the data is free to download and distribute, it is possible to serve it using GeoServer.   I recently went through the process of rendering OpenStreetMap’s data with GeoServer.

The data

OpenStreetMap provides instructions on downloading their data.  The full data set is a large file, currently about 4GB when compressed and about 100GB when uncompressed.  (You can download sections of the data set as well.)  This data is an XML-based data format that GeoServer cannot read natively.  PostGIS is the optimal way of storing such a large volume of data when using GeoServer.  Luckily, there is a converter that allows you to load the OpenStreetMap data into PostGIS called osm2pgsql.  This program is a package available on Debian-based distributions (such as Ubuntu), and is also available as a binary on Windows.

Run the following command:

osm2psql -E 900913 -d osm planet.osm

This will process the XML information and load the data into a PostGIS database called “osm”. The -E defines the projection of the source data, which in this case is 900913, the projection used in Google Maps, and the default for OpenStreetMap.

If successful, the database will contain the following tables:

planet_osm_line planet_osm_point planet_osm_polygon planet_osm_roads

Making sense of the data

OpenStreetMap’s data can be a bit confusing.  For a first time user like myself, just trying to figure out their naming convention was challenging.  They do, however, have a wonderful map key hidden away in their wiki.  This page is a lifesaver.

There are two different tables that contain line data, planet_osm_line and planet_osm_roads. The former includes railroads, subways, and other linear information.  The latter is made up exclusively of roads.  The planet_osm_point table has a range of data: subway stations, shopping centers, universities, and even brothels. Lastly the planet_osm_polygon table has, but is not limited to, parks, bodies of water, and even buildings in certain urban areas.

Styling

On my map I grouped the roads into three major groups; residential, secondary, and limited-access (highways).  To achieve this grouping I used the following SLD filters.

**Road class** **PropertyName** **Values**
Residential highway residential OR unclassified
Secondary highway primary OR secondary
Limited-access highway motorway OR trunk

I then styled the map to distinctly display the three groups of roads, and also varied their widths depending on the zoom level.  This was the most time-consuming part of the process, as I needed to create and evaluate styles for each zoom level.  The final SLD is very large, but is available for those interested.

Final touches

Since the purpose of this map was to create a viable base layer that anyone can incorporate into their mapping projects, performance was a concern.  To address this, I used GeoWebCache, a tile cache mechanism built into GeoServer.  The GeoWebCache documentation has details on this process.

The finished (?) map

The finished product can be found at http://demo.opengeo.org/openstreetmap.

Feel free to link to this map.  Use this OpenLayers code to get started.  This map is a work in progress.  Future enhancements will include adding public transportation systems, railroads, buildings, and more. If you have any feedback on this map please email me at iwillig at opengeo dot org.

With GeoServer, PostGIS, OpenLayers and the OpenStreetMap data set, it is possible to build high-quality, professional-looking maps, allowing you to take control of what data you present, define your own mapping aesthetic, and free yourself from having to use commercial map layers.

Read More

GeoServer 1.7.2 Released

The GeoServer team would like to announce the release of GeoServer 1.7.2. This release brings many exciting new features.

The first major improvement is label rendering. In version 1.7.1, GeoServer added support for curved labeling. In this version, support is added for wrapped labels, which enables a label to span multiple lines. This feature affects the labeling of points and polygons.

Thanks to Andrea Aime for all the great labeling improvements.

Another new styling feature is support for hatching. Among many other new designs, this allows railroad styling to be accomplished for the first time. Also, polygon hatched fills can now be drawn, and GeoServer ships with a new style, pophatch.sld, that can be applied to the topp:states layer to see this in action.

The 1.7.2 release also brings some great new extensions. The HTML imagemap extension (download), contributed by Mauro Bartolomeoli, allows a user to add interactive features to a map without the use of Flash, SVG, or other dynamic content languages. You can check out the imagemap extension in action. A special thanks to Mauro for the contribution.

The new and improved DB2 extension (download), which allows connection with IBM DB2 databases is based on the GeoTools JDBC Next Generation framework. The extension was contributed by Christian Müller, who is an active member of the GeoTools community. Special thanks to Christian.

The new OGR extension (download) is based on the GDAL/OGR library. The extension adds the ability to output from WFS any of the formats supported by OGR. OGR has a very diverse and comprehensive list of output formats, so this extension very much enhances the utility of the GeoServer WFS.

Improvements were also made to the GeoExt styler extension (download), which is a new graphical interface for map styling initially released with GeoServer 1.7.1. Tim Schaub, Andreas Hocevar, and the rest of the GeoExt team have added support for labels to the styler application.

Thanks to the GeoExt team for this great improvement.

In addition, a total of 70 issues were handled for 1.7.2.

Thanks to everyone who contributed features and bug reports for this release. We encourage you to download GeoServer 1.7.2, try it out, and let us know what you think. Comments and feedback are always welcome on the mailing list, as the community is always interested to hear how people are using GeoServer. Stay tuned for the 1.7.3 release, slated for release in the next month, which will include improvements to Geo Search, and the official release of the REST configuration API.

Read More

Throw GeoServer a curve (and it will be labeled)

Improvements to GeoServer are being made all the time, but to the average user, not all improvements are immediately discernible. However, recently a new feature has been added to GeoServer’s rendering algorithms, and all I can say is “wow.” I am referring to curved line labeling.

Labels on lines have rendering challenges that points and polygons do not. This is because lines can curve. Not officially, of course, but lines can be a collection of line segments, which meet at their edges but can be rotated with respect to each other. The default behavior for a label is to appear parallel to the orientation of a line. However, this can cause problems when the label resides along a curve, as the label will not follow it. In some extreme cases, the label can appear only marginally connected to the line, which minimizes the effectiveness of the label! Clearly, there was room for improvement.

This improvement was sponsored by TriMet, the Portland, Oregon area transportation agency that uses GeoServer in their Trip Planner. Lead GeoServer developer Andrea Aime tackled this task with his usual aplomb, and GeoServer now renders labels that follow curves. Below is worth two thousand words:

[gallery]

This new road labeling is only in versions 1.7.1 and later. Currently this functionality is not turned on by default, but is instead must be enabled in GeoServer. One way of doing this is to edit your web.xml file inside the WEB-INF directory. Stop your GeoServer instance, and insert the following code block:

` USE_NG_LABELLER true `

In addition, you also need to edit your SLD to include a VendorOption inside your TextSymbolizer. Add the following line:

`true`

Restart your GeoServer, and you’re all set!

For me, the ability for GeoServer to output curved line labels is a huge step forward. There’s something about these labels that make the map seem so much more professional. Special thanks to TriMet for sponsoring this awesome new feature. Have you tried it out yet?

Read More