How to use id-mapeo - 3 common examples

To help you get started, we’ve selected a few id-mapeo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digidem / mapeo-desktop / src / renderer / components / MapEditor / index.js View on Github external
function updateSettings () {
    var presets = ipcRenderer.sendSync('get-user-data', 'presets')
    var customCss = ipcRenderer.sendSync('get-user-data', 'css')
    var imagery = ipcRenderer.sendSync('get-user-data', 'imagery')
    var icons = ipcRenderer.sendSync('get-user-data', 'icons')

    if (presets) {
      const iDPresets = convertPresets(presets)
      if (!id.current) {
        iDPresets.fields = { ...iD.data.presets.fields, ...iDPresets.fields }
        iD.data.presets = iDPresets
      }
    }
    if (customCss) insertCss(customCss)
    if (imagery) {
      // iD upgraded to use 'dataImagery' in 2.14.3, this is for backwards
      // compatibility
      if (imagery.dataImagery) imagery = imagery.dataImagery
      imagery.forEach((img, idx) => {
        // Add id
        img.id = img.name + '_' + idx
        iD.data.imagery.unshift(img)
      })
    }
    if (icons) {
      var parser = new window.DOMParser()
      var iconsSvg = parser.parseFromString(icons, 'image/svg+xml')
github digidem / mapeo-desktop / src / renderer / components / MapEditor / index.js View on Github external
imagery.forEach((img, idx) => {
        // Add id
        img.id = img.name + '_' + idx
        iD.data.imagery.unshift(img)
      })
    }
github digidem / mapeo-desktop / src / renderer / components / MapEditor / index.js View on Github external
function initIdEditor () {
      if (!rootRef.current) return
      updateSettings()

      var serverUrl = 'http://' + remote.getGlobal('osmServerHost')
      id.current = window.id = iD
        .coreContext()
        .assetPath('node_modules/id-mapeo/dist/')
        .preauth({ url: serverUrl })
        .minEditableZoom(window.localStorage.getItem('minEditableZoom') || 14)

      if (!customDefs.current) {
        customDefs.current = id.current
          .container()
          .append('svg')
          .style('position', 'absolute')
          .style('width', '0px')
          .style('height', '0px')
          .attr('id', 'custom-defs')
          .append('defs')

        customDefs.current.append('svg')

id-mapeo

iD Editor for osm-p2p & mapeo-desktop

ISC
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Popular id-mapeo functions