Applied Spatial Databases Presentation Slide Deck
I recently put together a presentation for a graduate database class on the topic of Applied Spatial Databases. Thought I’d make the presentation available to anyone who might get some use out of it.
Java GIS Development Setup (Part 1)
In recent months I’ve been transitioning over to Java GIS development from .NET. One of the first hurdles going into any new language is tool selection, in addition to installing and setting each one up. This tutorial is geared towards those facing the same transition, or for those purely interested to see how to create Java GIS web applications. I’ll walk through downloading, installing, and configuring the tools below to get a base development environment set up. The list represents what I’ve found to be the most standard and helpful, even though this is subject to personal preferences.
- Java Standard Edition Software Development Kit (Java SE JDK)
- Eclipse Ganymede IDE
- Tomcat web server
- Direct Web Remoting (DWR) Ajax library
- Aptana JavaScript editor
Once everything is installed, I’ll demonstrate the tools with a simple ArcGIS Server JavaScript application in part 2. In subsequent posts I plan on making use of many other GIS web APIs like OpenLayers, GeoServer and Google Maps. I’m also ignoring the spatial database backend, but in time that will come too.
Step 1: Preinstall
Decide on a directory to put all Java downloads in, like C:\Java. This provides one-stop shopping for all java-related files. I’ll be using C:\java thr0ughout the rest of tutorial.
Step 2: Download and install the Java SE JDK
The JDK allows you to develop with the Java API and includes the Java Runtime Environment (JRE). Download the latest JDK (currently version 6 update 11) . The Standard Edition, as opposed to the Java EE version or Netbeans version, will suffice. After picking the platform (Linux, Solaris, Windows) and giving in to the license agreement, select the executable to download.
After downloading the executable, run it and install Development Tools and the Public JRE. It’s up to you if you want to install Source Code and the Java DB. Change the installation directory for Development Tools to C:\java\jdk1.6.0_11 and continue the install. Once Development Tools is installed, you’ll be prompted to install the JRE. Again, change the JRE install directory to C:\java\jdk1.6.0_11.
Step 3: Download and install Eclipse 3.4 Ganymede
Next up, go to Eclipse Downloads and grab the Eclipse IDE for Java EE Developers. The latest version is 3.4 Ganymede, which includes the Web Tools Platform for developing web apps. Once the download completes, extract the zip file to C:\java. Check to see if eclipse was installed in C:\java\eclipse.
Step 4: Download and Install Tomcat
Go to Apache Tomcat and download the zip file under the 6.0.18–>Binary Distributions–>Core section. Extract the zip to c:\java, then check to make sure Tomcat was installed in C:\java\apache-tomcat-6.0.18 (or the most current version).
Step 5: Download and Install Direct Web Remoting
DWR can be used to leverage AJAX (and the reverse) for Java Server applications. Download the most recent stable release (currently 2.05) of dwr.jar from DWR downloads and place it into C:\java\dwr. DWR also has a dependency on Apache Commons Logging, so download the appropriate binary distribution (currently 1.1.1) and install it to C:\java\commons-logging-1.1.1.
Step 6: Set up Eclipse
Three configurations need to be made to Eclipse the first time it’s run. First, the default workspace directory where projects are stored must be set. Launch Eclipse by executing C:\java\eclipse\eclipse.exe, and you’ll be prompted to configure the workspace. Set the workspace as C:\java\workspace, and make sure you check the box for making it default so you won’t get bugged at startup again.
Next, a welcome screen will display. Click the Workbench icon on the far right which will take you into the IDE. Now the JRE version can be configured. Under the Windows menu select Preferences and expand the Java–>Installed JREs tree node. You should see the version that was installed in step 2 (i.e. jre1.6.0_11) and its directory location. If you don’t, add it.
The last configuration is setting up your default browser. While you still have the Preferences dialog open, navigate to the General–>Web Browser node. There you can set your default browser of choice to run your apps in. In addition, I’d suggest using the external browser option if you want to code in Eclipse and run web pages in separate windows.
Step 7: Install the Aptana Studio Eclipse Plugin
While Eclipse has some native JavaScript support, I prefer to use the more robust Aptana plugin. It has better code auto-complete, makes it easier to utilize existing Ajax frameworks like Dojo and jQuery and has some nice productivity code snippets and scripts. As a bonus it has CSS and HTML editors. Aptana can be installed as an Eclpipse plugin, or could be used as a standalone JavaScript IDE.
For this setup we’ll install Aptana as a plugin into the Java IDE. To get started, go to the Eclipse Help–>Software Updates menu which will open the Software Updates and Add-ons dialog. Go to the Available Software tab and click the Add Site button. Enter http://update.aptana.com/update/studio/3.2/ and hit OK. You’ll now get a list of Aptana features to install and will need to check off the ones you want. I’ve provided a screenshot of the ones I installed for starters. One can always go back and install/uninstall features later. Click the Install button and verify the list of items you’ve chosen, click Finish and accept restarting Eclipse. Once Eclipse returns, you’ll be asked to install Aptana Subversion support, but it’s not necessary.
A My Aptana web page will be opened in the Eclipse editor for access to the Aptana web site. Before using Aptana you’ll need to open the Aptana Perspective by hitting the Add Perspective button in the upper right of the Eclipse. Choose the Other menu item and then choose Aptana in the Open Perspective dialog. The IDE will change to show References, Scripts, Snippets, Samples, etc.
One last thing to do is make Aptana the default editor for JavaScript files. Go to the Window–>Preferences menu and then navigate to the General–>Editors–>File Associations tree node. Click on *.js and select Aptana JS Editor as the default. You may want to do the same for *.json, *.css, and *.html. If you don’t go through these steps Eclipse will open the files in its own editor. Give it a whirl by creating a new JavaScript file by selecting the File–>New–>Untitled JavaScript File.
break;
This is a good breaking point before getting too lengthy. In part 2 I’ll undergo the creation of an ArcGIS Server JS API application, which will utilize the development environment described in the previous steps.
Flat Out Resuscitation
One of my goals this year was to revive my GIS blog, which suffered much neglect over the last year. In fact, I was even scrapped after the Planet Spatial Reboot. After reviewing some of my older posts I decided to start with a clean slate. The posts really didn’t add any value, so I wiped them out and am starting fresh.
I have a pile of ideas for blog topics saved up, but nothing to show as of yet. With a renewed focus on quality content, I’ll be taking a retrospective look over the last year on my experience with:
- ASP.NET/ASP.NET Ajax
- OO JavaScript
- Abandoning ArcGIS Server for Google Maps
- SQL Server 2008
- Open Source GIS (MapGuide, FDO, OpenLayers…)
At the same time, I’ll also be digging into some new territory as I’m starting a new job. While I’m not completely unfamiliar with these items, I’ll definitely be taking more of a deep dive:
- Java web development
- ArcGIS Server 9.3
- Weather GIS
- REST
- WMS/WFS/WCS
It should be quite interesting going from .NET to Java land, and to also be getting back into ArcGIS Server again. Happy reading…











