Geographic Search & Display Leila M. Gonzales American Geosciences Institute VuFind Summit 2016 Villanova University October 10, 2016
AGI’s Online Database Products 10K - 300K records depending on database DB/Text platform Metadata only – no full-text or map search Records contain geo-coordinates – points and rectangles Ocean Drilling Citation Database
Initial Implementation Geographic Search Custom code based on Moravian Library’s implementation using VuFind 2.4 and OpenLayers 2.13
Initial Implementation - Limitations Custom implementation Different APIs for search & display Geographic Search Only displays search box Uses OpenLayers 2.13 API Geographic Display Popups for rectangles needs improvement Uses Google Maps API Google now requires API key
VuFind 3.1 Geo Search & Display Preserve GoogleMap functionality Add new geographic functionality Update Solr indexing routines Add OpenLayers geo search & display code Support multiple points and rectangles per record Add configurable options
VuFind 3.1 Geo Search & Display InputData.mrc Record 20001 =034 $d $e $f $g $z Solr location_geo long_lat long_lat_display long_lat_label Geographic Display Geographic Search
Indexing Geographic Data Coordinates: 034 $d $e $f $g Decimal degrees or Degrees-min-sec Hemisphere: EW NS or +/- Coordinate order: WENS Points and/or Rectangles Coordinate labels: 034 $z Or use lookup table to assign labels by coordinate lookup Put lookup table in local/config/vufind/ InputData.mrc Record 20001 =034 $d $e $f $g $z =034 0\$aa$d+46.4$e+40.4$f+31.5$g+28.50$zSite 447 =034 0\$aa$dW10.1$eW10.1$fS5.7$gS5.7$zSite 440 =034 0\$aa$dW1172630$eW1172630$fN661503$gN661503$zSite 393
Indexing Geographic Data InputData.mrc Record 20001 =034 $d $e $f $g $z Solr location_geo: coordinates as BboxField type long_lat: for GoogleMaps display only long_lat_display: coordinate as in .mrc file long_lat_label: stored coordinate labels schema.xml: updated to include above fields and “geo” field type (see Solr Spatial Search Guide on BboxField type) marc_local.properties: configure indexing of geographic fields location.bsh: geographic indexing routines Solr Spatial Search Guide: https://cwiki.apache.org/confluence/display/solr/Spatial+Search
Geographic Display – GoogleMap Key Points Only point features Labels: Use stored labels or lookup table Must have GoogleMap API key config.ini ;Geographic Display recordMap = google mapLabels = driver OR mapLabels = file:lookup.txt googleMapApiKey = API Key
Geographic Display – OpenLayers Key Points Points and Rectangles Labels: Use stored labels or lookup table Display coordinates Translation of pop-up title (map_results_label) config.ini ;Geographic Display recordMap = openlayers mapLabels = driver OR mapLabels = file:lookup.txt displayCoords = true (or false)
Geographic Display – Customize RecordTab/map.phtml Also contains GoogleMap javascript code js/map_tab_ol.js OpenLayers javascript code RecordTab/Factory.php RecordTab/Map.php RecordDriver/SolrDefault.php
Geographic Search localhost/vufind/Search/Results?filter[]= bbox_geo:Intersects(ENVELOPE(-95, 30, 72, 15))
Geographic Search
Geographic Search Solr Bbox query against location_geo Zoom in / out (uncluster / cluster) Clusters <5 records: Pop-up with titles linked to records Displays center point of the first geographic feature of each record that intersects search box. Solr location_geo title id
Geographic Search Click on “Geographic Search” in search box Click on Draw Search Box, then click-drag-click search box
Geographic Search – Help Need Help? Uses VuFind help system Easier to maintain for language translation
Geographic Search - Configure Configurable options Default search box coordinates Don’t make it too large or too small Focus on area of most results Height Height of map interface in pixels searches.ini ;default_top_recommend[ ] = MapSelection … [MapSelection] default_coordinates = “-95, 30, 72, 15” height = 320
Geographic Search - Configure Configurable options Search parameter to allow searching by coordinate string. Queries against long_lat_display searches.ini [Basic_Searches] ;Coordinate = Coordinates [Advanced_Searches] [Autocomplete_Types] Coordinate = “None” searchspecs.yaml Coordinate: DismaxFields: - long_lat_display DismaxHandler: edismax
Geographic Search – Customize Recommend/MapSelection.phtml search/searchbox.phtml If enabled in searches.ini, Geographic Search option appears in search box. root/templates/HelpTranslations/en/geosearch.phtml js/map_selection.js Recommend/MapSelection.php View/Helper/Root/GeoCoords.php Returns geo search URL
Geographic Support Code OpenLayers 3.17.1 code js/vendor/ol/ol.js , ol-debug.js css/vendor/ol/ol.css RecordDriver/SolrDefault.php getLongLat getGeoLocation getDisplayCoordinates getCoordinateLabels CSS styling – add geoItem class for pop-ups css/compiled.css less/components/search.less
Future Improvements Polygon storage and search Fall-back logic for map tab label field Support OpenLayers cluster pop-up information Mouse-over to highlight all points associated with cluster Better handling of multiple features / center point calculations Specification of base map layer Option for graticule (lat/long grid) display on map “More like this” or Similar Items Map Recommendation module https://vufind.org/jira/browse/VUFIND-1199
Thank you for your attention Leila M. Gonzales lmg@americangeosciences.org American Geosciences Institute www.americangeosciences.org