   "Adds shapefile simplification header to response when shapefile simplication was
   requested."
   [handler default-format-fn]
-  (fn [{context :request-context :as request}]
+  (fn [{_context :request-context :as request}]
     (try
       (if-let [[[original-point-count new-point-count] result] (simplify-shapefile request)]
         (-> (assoc-in request [:params "shapefile"] result)

          url (URLs/fileToUrl file)
          data-store (GeoJSONDataStore. url)
          feature-source (.getFeatureSource data-store)
          feature-type (.getSchema feature-source)
          features (.getFeatures feature-source)
          feature-count (shapefile/error-if (.size features)
                                            #(< % 1)
                                            "GeoJSON has no features"
                                            nil)
          iterator (.features features)]
      (try
        (loop [features (ArrayList.)]
          (if (.hasNext iterator)
            (let [feature (.next iterator)]
              (.add features feature)
              (recur features))
            (simplify-data filename features feature-type mt/geojson)))
        (finally (do
                   (.close iterator)
                   (-> data-store .getFeatureReader .close)
                   (.delete file)))))
    (catch Exception e
      (let [{:keys [type errors]} (ex-data e)]
        (if (and type errors)

(defn- simplify-data
  "Given an ArrayList of Features simplify the Features and return stats about the process
  along with a new shapefile info map to replace the one in the search reqeust"
  [filename ^ArrayList features mime-type]
  (let [[simplified-features stats] (iterative-simplify features mime-type)
        [original-point-count new-point-count] stats]
    [[original-point-count
