Created
May 26, 2010 20:45
-
-
Save gavinheavyside/415029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns geotools.shape-viewer | |
(:import [org.geotools.data CachingFeatureSource FeatureSource FileDataStore FileDataStoreFinder]) | |
(:import [org.geotools.map DefaultMapContext MapContext]) | |
(:import [org.geotools.swing JMapFrame]) | |
(:import [org.geotools.swing.data JFileDataStoreChooser])) | |
(defn show-shapefile | |
"Prompts the user for a shapefile and displays its content" | |
[] | |
(if-let [shapefile (JFileDataStoreChooser/showOpenFile "shp" nil)] | |
(let [fs (.getFeatureSource (FileDataStoreFinder/getDataStore shapefile))] | |
(doto (DefaultMapContext.) | |
(.setTitle "Quickstart") | |
(.addLayer fs nil) | |
(JMapFrame/showMap))))) | |
(defn show-shapefile-cached | |
"Prompts the user for a shapefile and displays its content. | |
Uses memory-based cache to speed up display" | |
[] | |
(if-let [shapefile (JFileDataStoreChooser/showOpenFile "shp" nil)] | |
(let [fs (.getFeatureSource (FileDataStoreFinder/getDataStore shapefile)) | |
cache (CachingFeatureSource. fs)] | |
(doto (DefaultMapContext.) | |
(.setTitle "Quickstart") | |
(.addLayer cache nil) | |
(JMapFrame/showMap))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject geotools-something-like-this-perhaps "1.0.0-SNAPSHOT" | |
:description "FIXME: write" | |
:repositories {"osgeo-geotools" "http://download.osgeo.org/webdav/geotools"} | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
[org.geotools/gt-main "2.7-M3"]dd | |
[org.geotools/gt-shapefile "2.7-M3"]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!