Skip to content

fmidev/smartmet-plugin-autocomplete

Repository files navigation

Table of Contents

SmartMet Server

SmartMet Server is a data and product server for MetOcean data. It provides a high capacity and high availability data and product server for MetOcean data. The server is written in C++, since 2008 it has been in operational use by the Finnish Meteorological Institute FMI.

Introduction

The SmartMet autocmplete plugin provides an efficient and a fast method for completing the search locations. It provides the location information enriched with simple weather information. The figure below shows how the autocomplete plugin suggests several location information when we start to type a search location "de".

The main idea is to provide a Google Suggest type API geographic information stored in the fminames database. Autocomplete is a feature of the Places library in the Google Maps JavaScript API. The autocomplete API can provide a type-ahead-search behavior of the Google Maps search field. When a user starts typing an address, autocomplete will fill in the rest.

Main features

The main features offered by the plugin are as follows: 1.JSON output 2.Keyword identifies set of allowed locations 3.Language selection 4.Pretty printing for debugging purposes 5.Product specific customization of forecast parameters 6. Pagination of results

Query string options

Below we describe the query string options. The default value for each option is given in parenthesis. If there is no default value specified, the option is compulsory.

keyword

The keyword identifies the set of locations enabled in autocomplete. The allowed keywords are listed in

 fminames.keywords 

and the locations for each keyword in

 fminames.keywords_has_geonames 

Since Aug 4th 2021 the keyword may be a comma separated list. This enables one to join search results say from city names, amusement parks, golf courses etc.

pattern

The pattern is the beginning of the location name usually typed by the user. SmartMet server converts the UTF8 input to iso-latin-8859-1 and to lower case to make comparisons easier. The collation sevices are in use.

lang (fi)

The selected language using a 2-character language ISO-code. If no specific translation exists for a location, the primary name for the location will be returned.

max (15)

The number of results to return in one page.

page (0)

The page number. This option works in conjuction with the maxresults option.

format (json)

This option is deprecated. PHP-serialization used to be supported, but the support was terminated when json_spirit was taken into use.

pretty (0)

Pretty print is used mostly for debugging purposes (and regression tests to spot changes more easily).

product ()

Identify a product name to add localized forecast data to the output. The allowed product names are listed in a table.

 autocomplete.products 

and the forecast parameters for each product in

and the forecast parameters for each product in

 autocomplete.parameters 

The default is not to include a forecast in the output.

timeformat (iso)

The output format as supported by MacGyver::TimeFormatter (iso, xml, timestamp, sql).

locale (fi_FI)

Localization may be used for formatting locale specific forecast parameters.

stamp () y

Alternate forecast start time used only for creating static regression tests.

Formatting numeric values

The same options as used in the pointforecast-plugin are available for formatting floating point values:

  • missingtext
  • width
  • fill
  • adjustfield
  • showpos
  • uppercase
  • floatfield

Docker

SmartMet Server can be dockerized. This tutorial explains how to explains how to configure the Autocomplete plugin of the SmartMet Server when using Docker.