Class GeoCoordinateConverter

java.lang.Object
io.goobi.viewer.controller.GeoCoordinateConverter

public class GeoCoordinateConverter extends Object
Utility methods for converting geo-coordinated between different formats
Author:
florian
  • Field Details

  • Constructor Details

    • GeoCoordinateConverter

      public GeoCoordinateConverter()
    • GeoCoordinateConverter

      public GeoCoordinateConverter(String markerTitleConfig)
    • GeoCoordinateConverter

      public GeoCoordinateConverter(Map<String,Metadata> featureTitleConfigs, Map<String,Metadata> entityTitleConfigs)
    • GeoCoordinateConverter

      public GeoCoordinateConverter(javax.servlet.http.HttpServletRequest servletRequest)
  • Method Details

    • getFeaturesFromSolrQuery

      public List<GeoMapFeature> getFeaturesFromSolrQuery(String query, List<String> filterQueries, List<String> coordinateFields, String markerTitleField, boolean aggregateResults) throws PresentationException, IndexUnreachableException
      Collect all point coordinate in the given coordinate fields from solr documents returned by the given solr query
      Parameters:
      query - Solr query to get documents
      filterQueries - filter for solr query
      coordinateFields - fields containing the coordinate points to collect
      markerTitleField - solr field containing a title for the coordinates
      aggregateResults -
      Returns:
      a list of GeoMapFeature
      Throws:
      PresentationException
      IndexUnreachableException
    • getFeaturesFromSolrDocs

      public List<GeoMapFeature> getFeaturesFromSolrDocs(List<String> coordinateFields, String markerTitleField, Map<org.apache.solr.common.SolrDocument,List<org.apache.solr.common.SolrDocument>> docs)
    • getSolrFieldsForMainQuery

      public List<String> getSolrFieldsForMainQuery(List<String> coordinateFields, String markerTitleField, boolean aggregateResults)
    • getSolrFieldsForExpandQuery

      public List<String> getSolrFieldsForExpandQuery(List<String> coordinateFields, String markerTitleField)
    • getGeojsonPoints

      public Collection<GeoMapFeature> getGeojsonPoints(org.apache.solr.common.SolrDocument doc, List<org.apache.solr.common.SolrDocument> children, String metadataField, String titleField)
      Collect all point coordinate in the given metadata field within the given solr document
      Parameters:
      doc - the document containing the coordinates
      children -
      metadataField - The name of the solr field to search in
      titleField - solr field containing a title for the coordinates
      Returns:
      Collection
    • getGeojsonPoints

      public Collection<GeoMapFeature> getGeojsonPoints(org.apache.solr.common.SolrDocument doc, String metadataField, String titleField)
    • getGeojsonPoints

      public Collection<GeoMapFeature> getGeojsonPoints(MetadataContainer doc, String metadataField, String titleField)
    • createTitle

      public static de.intranda.metadata.multilanguage.IMetadataValue createTitle(Metadata labelConfig, Map<String,List<de.intranda.metadata.multilanguage.IMetadataValue>> metadata)
    • getFeatures

      public static List<GeoMapFeature> getFeatures(List<String> points)
      Generate a list of geoMapFeatures from a list of metadata values which may represent geographic coordinates. The coordinate strings may take one of three forms:
      • Point: 'x y'
      • Polygon: 'POLYGON((x1 y1, x2 y2,...))'
      • Geojon: a json object following the geojson format
      Parameters:
      points - A list of strings that represent two-dimensional coordinates or an array of such.
      Returns:
      The coordinates in form of geoMapFeatures
    • getLocations

      public static List<Location> getLocations(String solrFieldName, org.apache.solr.common.SolrDocumentList results)
      Parse geo-coordinates from all fields of the given name fromt the given list of SOLR documents
      Parameters:
      solrFieldName - Name of the SOLR fields to parse
      results - Documents to parse
      Returns:
      A list of geo-coordinates as Location
    • getLocations

      public static List<IArea> getLocations(Object o)
      Parse geo-coordinates from the value of a SOLR field
      Parameters:
      o - SOLR field value
      Returns:
      a list of IArea representing the locations from the given value