Septima.Search.SearchableGeoJson

Makes a geojson featurecollection searchable

Options

NameTypeMandatoryDefault valueDescription
dataobjectYesArray of features, or a function that returns a GeoJSON object, or a string URL returning a GeoJSON object
searchPropertiesArray.<string>YesArray of property names search in. If not added, all properties will be used
displaynamePropertystringYesThe name of the property in the GeoJSON object that should be used as displayname
descriptionPropertystringYesThe name of the property in the GeoJSON object that should be used as description
useANDbooleanYesUse AND and not OR when multiple terms is added by the user. Default true
singularstringYesSingular phrase, eg.: "feature"
pluralstringYesPlural phrase, eg.: "features"
cacheTTLint60Applicable to urls and functions (see options.data) How long should data be cached in seconds(0->no cache)
sridstringRead geometry as in EPSG:srid projection (Else use projection from data) * @api

Examples

Usage

Example

<!-- Include septimaSearch -->
<script type="text/javascript" src="http://search.cdn.septima.dk/{version}/septimasearch.min.js"/>
 var schools = {
  "type": "FeatureCollection",
  "features": [{
    "id": 1,
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [724837.68, 6175474.03]
    },
    "properties": {
      "navn": "Den Classenske Legatskole",
      "ogc_fid": 1,
      "omraade": "Indre By",
      "antalborn": "481",
      "skoleledernavn": "Lone Reichstein Laursen",
      "hjemmesideadresse": "http://www.dcl.kk.dk"
    }
  }, {
    "id": 2,
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [725231.21, 6177008.34]
    },
    "properties": {
      "navn": "Sølvgades Skole",
      "ogc_fid": 2,
      "omraade": "Indre By",
      "antalborn": "452",
      "skoleledernavn": "Ulla-Britt Sabroe",
      "hjemmesideadresse": "http://www.soel.kk.dk"
    }
  }, {
    "id": 3,
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [725396.37, 6177471.75]
    },
    "properties": {
      "navn": "Nyboder Skole",
      "ogc_fid": 3,
      "omraade": "Indre By",
      "antalborn": "550",
      "skoleledernavn": "Anders Mikkelsen",
      "hjemmesideadresse": "http://www.nyboderskole.kk.dk"
    }
  }, {
    "id": 4,
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [724839.83, 6177665.12]
    },
    "properties": {
      "navn": "Øster Farimagsgades Skole",
      "ogc_fid": 4,
      "omraade": "Indre By",
      "antalborn": "606",
      "skoleledernavn": "Axel Bech",
      "hjemmesideadresse": "http://www.oef.kk.dk"
    }
  }]
}

 var searchableGeoJSOn = new Septima.Search.SearchableGeoJson({
    singular: "School",
    plural: "Schools",
    data: schools,
    searchProperties: ["navn", "omraade"],
    displaynameProperty: "navn",
    descriptionProperty: "omraade",
    idProperty: "ogc_fid"
  })

 var schoolSearcher = new Septima.Search.DataSearcher({
    searchableData: searchableGeoJSOn
  })

 controller.addSearcher (schoolSearcher)