Options
All
  • Public
  • Public/Protected
  • All
Menu

open2json

Index

Functions

buildOsmQueryString

  • buildOsmQueryString(bbox: BoundingBox, tagFilters: string[], overpassTimeout: number): string

buildWikidataQueryString

conflate

  • conflate(osmGeoJson: FeatureCollection, wikidataGeoJson: FeatureCollection, options?: ProviderOptions): FeatureCollection
  • Conflate two GeoJson objects, copying Wikidata information into matching OpenStreetMap objects. Unmatched Wikidata objects are left out because the default wikidata query is broader than just drinking water fountains.

    Parameters

    • osmGeoJson: FeatureCollection

      GeoJson from OpenStreetMap, standardized.

    • wikidataGeoJson: FeatureCollection

      GeoJson from Wikidata, standardized.

    • Default value options: ProviderOptions = defaultOptions

      Provider Options (only the conflateRadius option is used)

    Returns FeatureCollection

createFeature

  • createFeature(obj: any, imageWidth: number): Feature

dropEmpty

  • dropEmpty(geoJsonArray: FeatureCollection[]): FeatureCollection[]
  • Drop any geoJsons that have zero features

    Parameters

    • geoJsonArray: FeatureCollection[]

    Returns FeatureCollection[]

getFilePath

  • getFilePath(file: string, width: number): undefined | string
  • Parameters

    • file: string

      Filename, without "File:" or similar

    • width: number

      Width of returned image thumbnail, optional

    Returns undefined | string

indexOfSmallest

  • indexOfSmallest(a: number[]): number

matchByLocation

  • matchByLocation(wikidataGeoJson: FeatureCollection, osmGeoJson: FeatureCollection, conflateRadius?: number): void
  • Parameters

    • wikidataGeoJson: FeatureCollection
    • osmGeoJson: FeatureCollection
    • Default value conflateRadius: number = defaultOptions.conflateRadius

    Returns void

matchByQID

  • matchByQID(wikidataGeoJson: FeatureCollection, osmGeoJson: FeatureCollection): void
  • Parameters

    • wikidataGeoJson: FeatureCollection
    • osmGeoJson: FeatureCollection

    Returns void

queryOsm

  • Function to query OSM with a bounding box and return simplified geojson object

    Parameters

    Returns Promise<FeatureCollection>

queryWikidata

  • Function to query Wikidata with a bounding box and return results as json. Multiple objects are returned if a wikidata has multiple images or locations. These duplicates can be removed with standardization.

    Parameters

    Returns Promise<FeatureCollection>

sanitizeFilename

  • sanitizeFilename(filename: string): string

standardizeOsm

  • standardizeOsm(data: FeatureCollection): FeatureCollection
  • standardize into simple geoJson format. Unavailable values are undefined

    Parameters

    • data: FeatureCollection

      data returned by OpenStreetMap overpass API

    Returns FeatureCollection

standardizeWikidata

  • standardizeWikidata(res: any, imageWidth?: number): FeatureCollection
  • Create GeoJson from wikidata response json. This involves extracting the image and location data, and removing duplicates

    Parameters

    • res: any

      Response from wikidata query

    • Default value imageWidth: number = 300

      Width of the image thumbnails that should be returned

    Returns FeatureCollection

Object literals

Const baselBoundingBox

baselBoundingBox: object

latMax

latMax: number = 47.7

latMin

latMin: number = 47.5

lonMax

lonMax: number = 7.7

lonMin

lonMin: number = 7.5

Const defaultOptions

defaultOptions: object

conflateRadius

conflateRadius: number = 20

overpassTagFilters

overpassTagFilters: string[] = [// see https://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Tag_request_clauses_.28or_.22tag_filters.22.29'amenity=drinking_water','drinking_water=yes',]

overpassTimeout

overpassTimeout: number = 30

overpassUrl

overpassUrl: string = "https://z.overpass-api.de/api/interpreter"

wdEntityClasses

wdEntityClasses: string[] = ['Q1630622', // drinking water fountain (Q1630622)'Q483453', // fountain (Q483453)'Q43483', // water well (Q43483)]

wdImageWidth

wdImageWidth: number = 350

wdLangs

wdLangs: string = "en,de,fr,it,es"

Const difficultArea

difficultArea: object

latMax

latMax: number = 55

latMin

latMin: number = 51

lonMax

lonMax: number = 15

lonMin

lonMin: number = 14

Const osmGeoJson

osmGeoJson: object

features

features: (object | object)[] = [{type: 'Feature',id: 'node/567050952',properties: {name: 'Fischermädchen-Brunnen',id: 'node/567050952',},geometry: { type: 'Point', coordinates: [7.5875386, 47.5512434] },},{type: 'Feature',id: 'node/575614798',properties: {id: 'node/575614798',},geometry: { type: 'Point', coordinates: [7.5873847, 47.555435] },},{type: 'Feature',id: 'node/583590302',properties: {name: 'Augustiner-Brunnen',id: 'node/583590302',},geometry: { type: 'Point', coordinates: [7.59034, 47.5579655] },},]

type

type: "FeatureCollection" = "FeatureCollection"

Const standardOsmGeoJson

standardOsmGeoJson: object

features

features: (object | object)[] = [{"type": "Feature","properties": {"name": "Froschbrunnen","id_osm": "node/201499848"},"geometry": {"type": "Point","coordinates": [8.0518839,47.386667]}},{"type": "Feature","properties": {"id_osm": "node/260353812"},"geometry": {"type": "Point","coordinates": [8.1844675,47.350443]}},{"type": "Feature","properties": {"id_osm": "node/260353813"},"geometry": {"type": "Point","coordinates": [8.1863668,47.3499435]}},{"type": "Feature","properties": {"id_osm": "node/260353814"},"geometry": {"type": "Point","coordinates": [8.1847468,47.3611431]}}]

type

type: "FeatureCollection" = "FeatureCollection"

Const standardWikiGeoJson

standardWikiGeoJson: object

features

features: object[] = [{"type": "Feature","properties": {"id_wikidata": "Q22952244","ispotable": true,"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Bourogne%2C_Lavoir_du_corps_de_garde.jpg/300px-Bourogne%2C_Lavoir_du_corps_de_garde.jpg","name": "fontaine-lavoir du corps de garde"},"geometry": {"type": "Point","coordinates": [6.919,47.5613]}},{"type": "Feature","properties": {"id_wikidata": "Q56570011","ispotable": true,"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Schwanengasse-Brunnen_(Schwan_-_Heinz_Schwarz_1956)_05.jpg/300px-Schwanengasse-Brunnen_(Schwan_-_Heinz_Schwarz_1956)_05.jpg","name": "Schwanengasse fountain"},"geometry": {"type": "Point","coordinates": [7.4391,46.9463]}},{"type": "Feature","properties": {"id_wikidata": "Q56721751","ispotable": false,"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/Zwillingsbrunnen_Bundeshaus_03.jpg/300px-Zwillingsbrunnen_Bundeshaus_03.jpg","name": "twin fountains Federal Palace"},"geometry": {"type": "Point","coordinates": [7.44432,46.94638]}}]

type

type: "FeatureCollection" = "FeatureCollection"

Const zuriBoundingBox

zuriBoundingBox: object

latMax

latMax: number = 47.36852337512103

latMin

latMin: number = 47.363692917827215

lonMax

lonMax: number = 8.539960384368896

lonMin

lonMin: number = 8.535035848617554

Generated using TypeDoc