Monday, March 25, 2013

Moving

This blog is moving to my domain at brian.digitalmaddox.com/blog.  Please update feeds accordingly :)

Sunday, November 18, 2012

Changes, They Are a Comin'

I'm going to try to start posting more here I think.  I'd like to get more into blogging (even podcasting).  This blog will keep its theme, just hopefully more content :)  I'm working on a long series of posts about using GIS tools and data since that's still near and dear to my heart.

I'm also going to keep posting other technical things of interest here as time permits.  I want to get into reviews and discussing technology as well.

Stay tuned!

Sunday, June 3, 2012

Fun with OpenStreetMap and Open Source

So as part of my pushing OpenStreetMap to people, I made some sample screen shots for a friend of mine who is wanting to move away from paying Google for their maps.  Thought I'd share in case other people want to see what's possible using OpenStreetMap data for rendering.

For my setup, I have PostgreSQL/PostGIS running on a server here at home.  In it I've imported:

On top of that, I'm also running the Geoserver 2.2 beta to provide all of the data as a WMS, WCS, and WFS OGC services.  The OSM data was imported using the excellent imposm tool.  I used the styles from OSMinaBox for WMS styling with some additions I made to the SLDs to make sure additional features were rendered.

The following screen shots are samples I've made using some of this data.  I threw them together for Doug so didn't really do any tweaking to label placements and the like. 

Screenshot 1 - OSM overview

In this screen shot, I used the US Tiger 2011 Counties data set for the background layer.  Plus it helped me to locate and zoom into my areas of interest.  The OSM* layers are all WMS renderings from my local Geoserver install using the above-mentioned SLDs.  OSM_Roads is actually a database view that imposm makes with all of the road layers merged together.

This second screenshot is zoomed in a level so that Geoserver does more labeling based on the SLD rules.

Screenshot 2 - Zoomed in example

On this third screenshot, I overlaid the USGS GNIS file with my own rendering rules inside QGIS.  I basically used SJJB icons under QGIS to make GNIS look a little nicer.  However, the bluish-green dots show I'm still not done with the style in QGIS and once it's done there I'll move it over to Geoserver to do the WMS rendering there as well.  
Screenshot 3 - GNIS overview


Here's my quick post for now.  Just wanted to do a quick showing of how you can make decent looking maps from completely free data.  I apologize in advance since I have no artistic skills whatsoever though :)

Saturday, February 11, 2012

A Random Post: Am I on a 32- or 64-bit OS?

So in response to a question on IRC this morning (and it's early and I'm not fully awake), here's a quick program I wrote to show how to detect if you're on a 16-, 32-, or 64- bit OS by checking the size of an int* in C/C++:

#include <iostream>


int main (int argc, char* argv[])
{
  int foo = sizeof(int*);
  
  switch (foo)
  {
  case 2:
    std::cout << "Size = 2: 16 bit OS" << std::endl;
    break;
  case 4:
    std::cout << "Size = 4: 32 bit OS" << std::endl;
    break;
  case 8:
    std::cout << "Size = 8: 64 bit OS" << std::endl;
    break;
  default:
    std::cout << "Size = " << foo << std::endl;
  }


  return(0);
}

Friday, December 16, 2011

My Latest Odd Project

So since the USGS is releasing a bunch of their old scanned paper maps at their Historical Topographic Map Collection, I thought it would be interesting to take the GeoPDF's there and georeference them to GeoTIFF's to compare to modern maps.  I've always had a thing about history, so thought this would be a fun side project to get my cartography back on.

Since QGIS doesn't yet import GeoPDF's, I'm first loading them into the GIMP (at around 300 dpi from the PDF), clipping the collar out, and saving them to a LZW-compressed TIFF.  Then I'm importing the TIFFs into QGIS and using the Georeferencing plugin to mark the grid points on the map.  I've read that the old maps were based on the Clarke 1866 ellipsoid, so in QGIS I'm setting the source projection to NAD27, which is based on Clarke 1866.  Yes, I know that technically this isn't fully correct in the cartographic sense, but then again georeferencing old paper maps like this also won't exactly put out a highly accurate GIS product either :P  I'm outputting them to WGS84 from the georeferencing plugin.  Times on my older Dell E1705 are around 5 minutes doing a polynomial interpolation with Lanczos interpolation.  Then again, I remember back in the mid to late 1990's when DRG production at the USGS on the old Data Generals would take a whole lot longer, so I wasn't going to complain :)

The output isn't so bad really.  Here's a sample of the output draped on top of Yahoo Street Maps (Google Maps and reprojection on the fly doesn't seem to work so well in QGIS right now).



Setting the Fredericksburg 1889 map to 50 percent transparency in QGIS and zooming in to old town, you can see that the map fits to a modern map surprisingly well.


I'll probably play around with this some more and maybe upload the georeferenced maps to archive.org or something along those lines.

Thursday, August 18, 2011

Building OpenCV 2.3.1 on Ubuntu 11.04

Getting OpenCV 2.3.1 to compile on Ubuntu can be interesting.  The first issue is tracking down all of the dependencies you need to get the different parts of it to work properly.  There is more information on dependencies needed at the OpenCV wiki here and here.  I found this page on a blog as well which will help to get a lot of the dependencies down.

For me specifically, I had a couple of problems on 11.04.  Make sure you have the following packages installed to enable gstreamer and unicap support:

libgstreamer-plugins-base0.10-dev
libgstreamer0.10-dev
libunicap2
libunicap2-dev
libucil2-dev

The second major problem is that OpenCV 2.3.1 doesn't fully track the latest releases of ffmpeg.  This patch helps, but bear in mind that it's for OpenCV 2.3.0 and there have been changes between versions.  You'll have to install the patch by hand to take care of some of the differences.

Once this is done, you should be ready to build.  On my system I ran cmake as:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_XINE=ON -D WITH_UNICAP=ON -D BUILD_EXAMPLES=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_DOCUMENTATION=ON -D BUILD_SHARED_LIBS=ON ..
If you have all of the extra media repositories on Ubuntu enabled, I'd highly recommend NOT disabling shared libraries when building OpenCV.  You'll avoid some linking errors due to concurrent versions of some of the multimedia libraries that might be installed.

After that, when you compile make sure you add in something like -I/usr/local/include and -L/usr/local/lib to your makefile to make sure you're pulling in the version you just compiled instead of the default and you should be good to go.

Parallel Programming: Understanding the impact of Critical Sections

Found this link earlier.  More and more people need to learn how to properly do parallel programming, but we seem to be getting less and less graduates that understand how to do it.