       callback(markerList)
     )
 
-  @fitToResults: (points) ->
+  fitToResults: (points) ->
     lats = points.map((p) -> parseFloat(p.the_geom_latitude))
     lons = points.map((p) -> parseFloat(p.the_geom_longitude))
 

class ProtectedPlanet.Maps.Search
  @showSearchResults: (map, url) ->
    return unless url?

    @getPoints(url, (points) =>
      markers = L.markerClusterGroup(
        showCoverageOnHover: false
      ).addLayers(points)
      map.addLayer(markers)
    )

  @getPoints: (url, callback) ->
    $.get(url, (protected_areas) =>
      markerList = []

      for pa in protected_areas

    maxLon = Math.max.apply(Math, lons)
    minLon = Math.min.apply(Math, lons)

    ProtectedPlanet.Maps.Bounds.setToBounds(@map, {
      boundFrom: [maxLat,maxLon],
      boundTo: [minLat, minLon]
    })

  linkTo: (pa) ->
    "<a href=\"/#{pa.wdpa_id}\">#{pa.name}</a>"
