Archive for June, 2006

Jun 25 2006

Mapserver Include

Published by perrygeo under GIS Tutorials

If you mange even a small number of Mapserver sites, eventually you notice that you use a number of identical layers in multiple mapfiles. The way this is typically done is to copy and paste the LAYER definition into each mapfile. But inevitably you’ll need to change the styling or the data source and you have to manually go through each mapfile to sync the changes. Wouldn’t it be nice to define the layer in a single file and use it in many mapfiles?

While Mapserver has no concept of an “include”, the C preprocessor (cpp) does. This is mentioned on the Mapserver list every time the subject of includes comes up. Still I have yet to find an actual example so I thought I’d share my notes on how I accomplish a mapserver include:

  1. Create your mapfile as usual but leave out any LAYER definitions that you wish to share amongst mapfiles. Instead use something like :

    #include “landsat.layer”

  2. The C Preprocessor doesn’t deal well with “#” which is the mapfile’s chosen comment charachter. Instead replace with “##” to indicate a comment
  3. Save this pseudo-mapfile as mymap.template
  4. Create a file in the same directory called landsat.layer with the LAYER block.
  5. Run the template through the preprocessor to generate the real mapfile :
    cpp -P -C -o mymap.map mymap.template 

The next step would be to script the preprocessing of all your mapfiles so that changing a layer definition in multiple mapfiles was as simple as changing the *.layer file and running the script.

No responses yet

Jun 15 2006

Some thoughts on Where 2.0

Published by perrygeo under Uncategorized

Oh man, it’s a long drive from San Jose back to Santa Barbara! Anyways, just got back from where 2.0 and want to throw out my quick summary of the event.

  • There was alot of talk about all things open; open data, open source and open standards. There was lots of buzz around the open street map project, osgeo applications like grass, ossim, gdal, mapbender, etc., and tons of discussion of WMS, WFS and other relevant standards. This is great as I think all three will be the cornerstone of the spatial industry in the near future.

    But, as I’ve mentioned before, people throw the word “open” around so much that it begins to loose meaning. From alot of conversations I had, I found many people were confused about the differences. Some folks seemed to think that the osgeo foundation was a data repository for open data (it may soon be! .. but not quite yet) and also that osgeo was an open standards organization trying to “compete” with the OGC. But that is what an event like this is for; to reach out and communicate, clarify and bridge the gaps between communities.

    Of course I had to laugh as I heard a couple dozen people refer to Google Maps as an “open source” application…. it’s proprietary source code using proprietary data through a proprietary data transfer mechanism. It may be “free” as in beer but that’s about the extent of it’s openness.

  • Social Data: using location technology as the basis for sharing personal experiences and social networking was a powerful theme at Where 2.0. It ran the gammut from tagging locations to writing personal travelogs to mobile location-based games to virtual worlds to mobile apps that would could differentiate stangers vs aquantainces in range of your bluetooth device.
  • Security and privacy: There are implications to the web/where2.0 mindframe. Publishing your location and personal information in real time through the web and mobile devices brings up some frightening security and privacy issues. Who owns the data? What licenses are your personal data distributed under? Do you need others permission to post their photos or locations? Who decides what is acceptable and what gets taken down? How is spam dealt with? Only two speakers were brave enough to fully address these issues head on and the panel had some good discussion on these topics. Kudos to them.
  • Bringing location technology to the masses: This was repeated by a few speakers; that in order to be successful in spatial technologies you need to bring your service to the masses. Certainly if you’re trying to compete in the social networking space, this is true. But in general GIS and spatial tech has application that are far beyond the interests of the vast majority of people.. emergency management, infrastructure, environmental, real estate, etc.

    The mantra that spatial data and services must appeal to a wide audience is analogous to saying that family cars are the only successful type of motorized vehicle. In terms of numbers, they may be a majority. But in terms of utility, there is a reason that construction companies pay hundreds of thousands of dollars for heavy industrial machinery.. because trying to haul tons of earth and debris with a Toyota Camry just doesn’t work. Likewise there is a similar reason most municipalities don’t use a Google Mashup to manage their parcel data.. it simply doesn’t work. So what is appropriate for mass consumption may have little applicabilty to business/government/industry/research. And vice versa.

  • Mobile Applications: So much potential here and some really cool innovations in geotagging content. Really, for the first time, I got a sense that these personal devices could become a means for creating a vast database of socially relevant information. But the lack of security and privacy safegaurds along with the domination of the cellular networks and the heterogenous environment of mobile platforms, I still view most of this as pie-in-the-sky.
  • Some new discoveries:
    • metacarta: A text parsing engine with a public API to extract geo info from plain text!
    • gutenkarte: An application of the above to classic works of literature.
    • open layers: A javascript application with a slick UI and simple API for displaying WMS and WFS
    • open street map: A fantastic project focussing on collaborative development of a public street database
    • mapstraction: A javascript layer on top of the ‘Big 3′ Mapping APIs that allows yoiu to switch seamlessly between the service providers.
    • Google Earth & Sketchup: GE for linux!!! Wooo-hooo!! There was also a sweet demo of creating 3D drawings in Sketchup and placing them in GE. Very slick.
    • Google Maps: Now with kml support! Just try http://maps.google.com/?q=http://path.to.your.kml
    • Mapguide: I am embarrased to say I have never tried out Autodesk’s open source offering but the demo was sweet.. a very high powered GIS for a web app. And the Autodesk folks were about the nicest group of guys you could meet.
    • ArcGIS/Server 9.2: Author a map in ArcMap. Save as .mxd. Drop into web server. Instant kml and wms server!
    • And while not new to me, there were alot of good overviews of some of my favorite software packages like OSSIM, GRASS, GDAL, Geoserver and World Wind (Java version coming this fall!!).
  • Finally, the prize for most interesting talk goes to Chris Spurgeon who spoke about the best geohacks of the last 3000 years. Long before computers, Chris showed how Eratosthenes measured the diameter of the earth, how the Polypenesian’s used the stars as an advanced navigation system, how the post-renaissance world rediscovered stars as a the key to navigation. And in more recent times he showed how Harry Beck reinvented the cartography of transportation with the London subway maps and how the VOR transmitters created highways in the featureless sky. This presentation really put current innovations in location technologies into perspective.
  • OK sorry about the lack of links but it’s too late in the evening for that. Hope you enjoyed my rundown and I’m sure I’ll have more to say after I get some sleep!

3 responses so far

Jun 09 2006

Animating the Blue Marble

Published by perrygeo under Uncategorized

A while back I posted my technique for creating an animated gif out of a time series of maps. While this may have been the pinnacle of web animation circa 1997, the animated gif just didn’t quite seem hip enough for this day and age.

Today I found a more modern example. This WorldKit interface, built with Flash, shows the seasonal progression of snow and land cover changes courtesy of the next generation Blue marble images. Complete with time slider, image fading and full animation controls, this interface really shines at providing an interactive experience rather than a passive visual display.

One response so far

Jun 03 2006

HostGIS Linux 3.6 Released

Published by perrygeo under Software

Though probably not as big of a news item as this week’s release of Ubuntu Dapper, there’s another Linux release that might be of interest to us GIS folk:

Built off of a Slackware base (one of the oldest, most stable linux distros), HostGIS Linux aims to be a “minimal yet complete” distribution specifically built with GIS in mind. It is first and foremost a server platform; it does not include any window system at all. If you’re looking for desktop GIS applications out-of-box, it might not be the best for you.

But for a GIS server, it comes with most of the open source stack preinstalled and configured. This latest release has a few changes and version upgrades for most of the components.

  • PHP, Python and Perl Mapscript
  • GDAL/OGR with PHP, Python and perl bindings
  • Postgresql 8.1 with PostGIS 1.1
  • drivers for many extra formats including jpeg2000 and ecw
  • Apache web server with Mapserver CGI

The primary motivation for creating HGL was to speed up the installation of new gis-enabled servers. Gregor Mosheh, the head programmer for HostGIS, has done an excellent job pretty much single-handedly putting this together. ( In full disclosure, I do consulting work for HostGIS, though I wasn’t really involved in the creation of HostGIS Linux. )

The setup is your standard text-based install and is a piece of cake if you’ve ever installed Linux before. When you’re through, you have the good ole’ black and white text console staring at you. Not very interesting… But the really satisfying part is to fire up a web browser after the install and be able to point it to a working webGIS application. Anyone who has spent the time to set up the mapserver stack and its seemingly infinite dependencies can appreciate the amount of work this saves!

If you’re not into learning a new distro, there is always the FGS linux installer which will set up a similar software stack on pretty much any linux.

And for Desktop GIS, many linux distros have a selection of GIS apps in their package repositories (You’ll want to certainly grab GRASS, GDAL and QGIS) . FWTools can be a good option on both Linux and Windows to get you up and running quickly. Finally there are a number of other more desktop-oriented distros for GIS including Knoppix GIS and GeoLivre, both of which run as a live-cd so you can check it out before you install.

Anyways, back to sum up HostGIS Linux:

If you need to set up a GIS server with minimal fuss and you have some experience with Linux, you might like to try it out. It will save lots of time.

If you’re a GIS user who needs a graphic windows environment to do GIS work on the Desktop, HostGIS Linux will not really make you happy out-of-the-box. Of course, since HGL is slackware based, you can use the slackware package management system to build an impressive Desktop system. But if you don’t need to run a server or really care about having the latest versions, Ubuntu comes with a solid desktop environment and packages for alot of good GIS apps.

No responses yet