Getting Started with the uDig SDK: A Beginner’s Guide

uDig SDK Tutorial: Integrating Maps and Plugins — Step-by-Step

Overview

A concise, practical tutorial to set up uDig SDK, create a basic map application, and extend it with plugins. Assumes Java and Eclipse familiarity.

Prerequisites

  • Java JDK 11+ installed and JAVAHOME set
  • Eclipse IDE for RCP and RAP Developers (or Eclipse IDE with PDE)
  • uDig SDK distribution or uDig source (latest stable release)
  • Basic knowledge of OGC formats (WMS, WFS, Shapefile)

1. Set up the uDig SDK in Eclipse

  1. Install Eclipse PDE/RCP package.
  2. Download the uDig SDK or add the uDig update site to Eclipse: Help → Install New Software → add uDig update URL.
  3. Install uDig features and SDK tooling, then restart Eclipse.
  4. Import uDig projects if using source: File → Import → Existing Projects into Workspace.

2. Create a new uDig RCP application

  1. File → New → Other → Plug-in Project.
  2. Choose an ID (e.g., com.example.udigapp), target platform Eclipse RCP.
  3. In the plugin manifest, require uDig core bundles (org.locationtech.udig.or org.location.udig.* depending on distribution).
  4. Create an application extension that uses the uDig map frame or reuse uDig product templates.

3. Add a map and layers

  1. Programmatically create a Map instance or use the provided MapEditor.
  2. Add data stores:
    • Shapefile: use ShapefileDataStore and create FeatureSource.
    • WMS: create a WMS service and request layers.
  3. Create Style objects (SLD or uDig styling APIs) and attach to layers.
  4. Add layers to the Map’s LayerManager and refresh the map canvas.

Code sketch (conceptual; adapt to uDig SDK APIs):

java

Map map = CatalogPlugin.getDefault().getMapManager().createMap(“MyMap”); ILayer layer = map.getLayerFactory().createLayer(featureSource, style); map.getLayerManager().getLayersInternal().add(layer); map.getViewportModel().setExtent(layer.getBounds());

4. Implement basic interaction

  • Zoom/pan: hook into IViewportModel or map commands.
  • Feature selection: use selection tools provided by uDig or implement IToolAdvisor extensions.
  • Attribute display: open a simple SWT dialog or view showing selected feature attributes.

5. Build a plugin

  1. In plugin.xml add extensions:
    • org.eclipse.ui.views for custom views (attribute table).
    • org.eclipse.ui.commands and handlers for toolbar/menu actions.
    • uDig-specific extension points for tools and menus (check SDK docs for exact IDs).
  2. Implement handlers to interact with Map and Layer APIs.

6. Packaging and running

  1. Use Eclipse product export or launch configuration to run an Eclipse application instance.
  2. Test loading remote services, large shapefiles, and plugin commands.

7. Debugging and performance tips

  • Enable Eclipse remote debugging for runtime issues.
  • Profile rendering hotspots; reduce symbol complexity and use simplified geometries for large datasets.
  • Cache WMS tiles where possible.

Resources

  • uDig SDK documentation and API Javadocs (use the SDK distribution or update site).
  • Examples in the uDig sample projects (import into workspace).
  • OGC service docs for WMS/WFS integration.

If you want, I can produce a concrete example project with exact plugin.xml entries and working Java code for a simple Shapefile layer application.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *