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 Alpers
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeoCoordinateConverter(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) Collects all point coordinates in the given coordinate fields from solr documents returned by the given solr query.getGeojsonPoints(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) Collects all point coordinates in the given metadata field within the given solr document.Parses geo-coordinates from the value of a SOLR field.getLocations(String solrFieldName, org.apache.solr.common.SolrDocumentList results) Parses geo-coordinates from all fields of the given name from the given list of SOLR documents.getSolrFieldsForExpandQuery(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:
-
COMPILED_POINT_PATTERN
-
COMPILED_POLYGON_PATTERN
-
-
Constructor Details
-
GeoCoordinateConverter
public GeoCoordinateConverter() -
GeoCoordinateConverter
-
GeoCoordinateConverter
-
GeoCoordinateConverter
-
-
Method Details
-
getFeaturesFromSolrQuery
public List<GeoMapFeature> getFeaturesFromSolrQuery(String query, List<String> filterQueries, List<String> coordinateFields, String markerTitleField, boolean aggregateResults) throws PresentationException, IndexUnreachableException Collects all point coordinates 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- if true, group coordinates from child documents under their parent- 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) Collects all point coordinates in the given metadata field within the given solr document.- Parameters:
doc- the document containing the coordinateschildren- child Solr documents associated with the parent docmetadataField- 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) Parses geo-coordinates from all fields of the given name from 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
Parses 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
-