Package io.goobi.viewer.controller
Class GeoCoordinateConverter
java.lang.Object
io.goobi.viewer.controller.GeoCoordinateConverter
Utility methods for converting geo-coordinated between different formats
- Author:
- florian
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeoCoordinateConverter(jakarta.servlet.http.HttpServletRequest servletRequest) GeoCoordinateConverter(String markerTitleConfig) GeoCoordinateConverter(Map<String, Metadata> featureTitleConfigs, Map<String, Metadata> entityTitleConfigs) -
Method Summary
Modifier and TypeMethodDescriptionstatic de.intranda.metadata.multilanguage.IMetadataValuecreateTitle(Metadata labelConfig, Map<String, List<de.intranda.metadata.multilanguage.IMetadataValue>> metadata) getFeatures(List<String> points) Generate a list ofgeoMapFeaturesfrom a list of metadata values which may represent geographic coordinates.getFeaturesFromSolrDocs(List<String> coordinateFields, String markerTitleField, Map<org.apache.solr.common.SolrDocument, List<org.apache.solr.common.SolrDocument>> docs) getFeaturesFromSolrQuery(String query, List<String> filterQueries, List<String> coordinateFields, String markerTitleField, boolean aggregateResults) Collect all point coordinate in the given coordinate fields from solr documents returned by the given solr querygetGeojsonPoints(MetadataContainer doc, String metadataField, String titleField) getGeojsonPoints(org.apache.solr.common.SolrDocument doc, String metadataField, String titleField) 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 documentParse geo-coordinates from the value of a SOLR fieldgetLocations(String solrFieldName, org.apache.solr.common.SolrDocumentList results) Parse geo-coordinates from all fields of the given name fromt the given list of SOLR documentsgetSolrFieldsForExpandQuery(List<String> coordinateFields, String markerTitleField) getSolrFieldsForMainQuery(List<String> coordinateFields, String markerTitleField, boolean aggregateResults)
-
Field Details
-
POINT_LAT_LNG_PATTERN
- See Also:
-
POLYGON_LAT_LNG_PATTERN
- See Also:
-
-
Constructor Details
-
GeoCoordinateConverter
public GeoCoordinateConverter() -
GeoCoordinateConverter
-
GeoCoordinateConverter
-
GeoCoordinateConverter
public GeoCoordinateConverter(jakarta.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 documentsfilterQueries- filter for solr querycoordinateFields- fields containing the coordinate points to collectmarkerTitleField- solr field containing a title for the coordinatesaggregateResults-- Returns:
- a list of
GeoMapFeature - Throws:
PresentationExceptionIndexUnreachableException
-
getFeaturesFromSolrDocs
-
getSolrFieldsForMainQuery
-
getSolrFieldsForExpandQuery
-
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 coordinateschildren-metadataField- The name of the solr field to search intitleField- 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
-
getFeatures
Generate a list ofgeoMapFeaturesfrom 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 parseresults- Documents to parse- Returns:
- A list of geo-coordinates as
Location
-
getLocations
Parse geo-coordinates from the value of a SOLR field- Parameters:
o- SOLR field value- Returns:
- a list of
IArearepresenting the locations from the given value
-