Friday, July 11, 2008

GPX2SHP - Win32 with C# source code


I have been searching for some time for a simple GPX to SHP file converter. Both of these file formats are used extensively in geospatial applications, but for some reason no one has created a converter between these two files.

So, being a programmer, I decided to remedy this situation.

Download GPX2SHP Binary- for Win32

the binary version requires the .Net 2.0 framework to be installed on your computer. You can download the framework here.

Currently only waypoints are converted - tracks will be added in the future.

If you're a programmer, you can download the Visual Studio .Net 2005 C# Source Code for this project here.

If this program works for you (or if it doesn't), you can email me at jsuwala@gmail.com.

April 13 2009 update: the download links above are now working!

Labels: , ,

Bad Design

Two good websites that talk about bad design:

Bad Human Factors Design: http://www.baddesigns.com/


Interface Hall of Shame: http://homepage.mac.com/bradster/iarchitect/shame.htm

Labels: ,

Tuesday, January 29, 2008

Dissolution of Social Networks

Andreas Kluth (San Francisco correspondent for The Economist) talking about real and virtual campfires, and predicts the dissolution of standalone social networks (such as FaceBook and MySpace) as we know them.


Anyone interested in the next generation of internet technology really needs to listen to this podcast. Its clear, concise and really gets at the heart of many social graph issues and human behavior.



Labels: , ,

Wednesday, July 18, 2007

Trac on Windows XP and IIS

Trac is a web-based software development tool. It's cool features include having a wiki, and integrating beautifully with Subversion for source control. Trac is used by a lot of open source projects, including my favourite map viewer, OpenLayers.

So I wanted to install Trac on my Windows XP based development box. This was all fun until I found that Trac is written in Python. In my experience, programs written in Python ususally don't work well on Windows. Here's how I got it to work:

Step 1: Download and install all components

Follow the instructions on this page to install Python, Trac, ClearSilver, Subversion for Python, and PySqLite.

Step 2: Setup a Trac Project

Follow the instructions on setting up a project as described on this page.

Step 3: Test using tracd

Test your installation using the built-in web server, tracd. If it doesn't work, you've done something wrong.

Step 4: Setup IIS Virtual Directories

Go into your IIS Admin panel and create a new virtual directory. This could be called anything that you want, but I called mine "trac". This virtual directory should map to the "C:\Python24\share\trac\cgi-bin" directory.

Add two application extension mappings for this directory: .cgi and .py files should both execute the "C:\Python24\python.exe -u %s %s" command (the -u and the two %s are very important!).

Step 5: Modify various files

Modify the "C:\Python24\share\trac\cgi-bin\trac.cgi" file to add two lines under the "try:" statement (my test project is installed in the directory c:\projects\trac\testProject\")
try:
import os
os.environ['TRAC_ENV'] = "C:/projects/trac/testProject/"
from trac.web import cgi_frontend
cgi_frontend.run()

Modify the "C:\Python24\Lib\site-packages\trac\web\api.py" file's line 219/220:
Old code:
path_info = property(fget=lambda self: self.environ.get('PATH_INFO', '').decode('utf-8'), doc='Path inside the application')
Replace with:
path_info = property(fget=lambda self: self.environ.get('PATH_INFO','').decode('utf-8').replace( self.environ.get('SCRIPT_NAME', ''), ''), doc='Path inside the application')

Modify the "C:\Python24\Lib\site-packages\trac\web\main.py" file's line 302:
Old code:
path_info = environ.get('PATH_INFO')
Replace with:
path_info = environ.get('PATH_INFO', '').replace( environ.get('SCRIPT_NAME', ''), '').lstrip('/').split('/')

Step 6: Test

Open up your web browser, and go to http://localhost/trac/trac.cgi and see what happens!

Labels:

Thursday, April 19, 2007

Convert VB.Net <-> C#


Every once in-a-while I need to convert between VB.Net and C#. Doing this by hand is a pain, but now there are some automated tools to help.

Telerik Code Coverter is a free simple VB.NET to C# code converter and vice-versa. It's shaping up to be one of the best code converters out there.

Labels:

Tuesday, February 27, 2007

GPS to PostGIS data import pipeline

I have found an interesting OpenSource based system that should allow you to import GPS track/route/waypoint information from your GPS into the OpenSource spatial database PostGIS. Here are the steps and tools:

  1. Convert your GPS data to the GPX format using GPSBabel
  2. Use the GPX2SHP program to create a SHP (ESRI Shape File)
  3. Import the SHP file into PostGIS using shp2pgsql
With your GPS data in PostGIS, you should be able to do all sorts of cool things.

For PostGIS data import, the following tools are interesting:

Labels: , ,

Friday, February 23, 2007

Tech Support in the Middle Ages

Labels: ,

Thursday, January 25, 2007

Mapping with WMS

Some quick map links:

To add your own WMS (Web Mapping Server) to Google Maps, check out the javascript here: http://docs.codehaus.org/display/GEOSDOC/Google+Maps. They talk about GeoServer (a Java Map engine), but the javascript doesn't rely on any WMS server in-particular.

If you are using a standards compliant WMS, check out this SLD (Style Layer Discriptor) to style your maps like Google does (or very close).

Labels: , ,

Friday, November 10, 2006

Map Layers from All-Over

Creating maps that integrate data from all-over the place would be super-spiffy. You have corporate GIS data; you have beatiful Microsoft Virtual Earth imagery; you have functional google maps imagery.

OpenLayers is a Javascript API that is trying to bring all this stuff together. Unfortunately it has some pretty major usability issues to deal with.

This guy has a hack for adding your WMS imagery to a google map. See it in action here. An even better example is here (it brings together layers from TerraServer, Google, and a WMS). Or do it with Virtual Earth.

My short-term goal is simply to figure out how to join our corporate GIS data visually together with any WMS server. It may mean hacking, but hopefully not.

Labels: , ,

Wednesday, December 07, 2005

ASP.Net (C#) Forms Authentication to a Domain without impersonation

You would think that making an ASP.Net web application that authenticates to an active directory domain should be fairly straight-forward. Unfortunately it is not for users of Microsoft .Net 1.1. (Microsoft.Net 2.0 has the ActiveDirectoryMembershipProvider class).

The regular way for ASP.Net applications to query ActiveDirectory is by changing the user that the web application runs under. This seems a little bit bizarre.

So I've made a simple web application that uses several DLL calls to do what Microsoft should have done a long time ago.

The DLL calls that are needed are both found in advapi32.dll:
  • LogonUser
  • GetTokenInformation
Unfortunately calling these functions from managed .Net functions was far-from-simple. But I ended up getting it to work.

Labels:

Thursday, December 01, 2005

dotLucene Search Engine using C# and IFilter

Creating a search engine for a website using OpenSource systems is highly painful, even though it doesn't need to be.

It was my task (prescribed by myself) recently to create a search engine for an internal website for basically no money. Because the application will be built in ASP.Net, the code had to be in C#.

Searching around the net, I found a promising project by the Apache project called "Lucene". Lucene looked very powerful, and most of all, was OpenSource. The only problem with Apache's Lucene is that it's all in Java (which I don't want to use).

So doing a search for "Lucene C#", I came across several projects - both of which are dead:
It took me a lot more searching to find "dotLucene" which is still OpenSource, and is still active.

To cut a long story short, dotLucene did not work for me out-of-the-box, and its programming interfaces appear to have inherited the pain of the Java version. Plus dotLucene could not index Word or PDF files out-of-the-box (it only did HTML).

Things I tried to get dotLucene to work:
Through much trial-and-error, I finally got something that appears to "Just Work".


Note: this source code uses sources taken from all-over-the-place. I do not assert any of my own intellectual rights to any of this.

Labels:

Tuesday, August 23, 2005

Geocoding Canadian Addresses

Looks like there's finally a Canadian equivalent to www.geocoder.us - www.geocode.ca!

Now all I need to do is create my own cool zooming map of Port Moody with my own cool JavaScript viewer (so that I don't have to worry about Google Maps' Terms which allow for advertisements). Of course drawing circles and overlaying information on Google Maps looks very promising.

It looks like someone has been able to overlay their own tiles onto Google Maps - so that you can use Google's interface to show your own graphics. This same technique is used for a subway map of NYC. Too cool.

More: a tutorial on making your own google map type, and even a photoshop script to make all the tiles.

The updating map of where the trains are *right now* in Dublin is really cool.

Labels: ,

Friday, August 19, 2005

Displaying an RSS Feed in your sidebar

I've found a very cool service that allows you to display an RSS feed on your website. For example, you can add a feed to your side bar. The best part of this is that no advertisements are currently inserted - giving you a clean looking page.

This service is hosted here, but they would like you to use one of their mirrors.

Labels: