Skip to content

Add support for nested attribute properties #55

@hparkertt

Description

@hparkertt

The goal for this enhancement is to provide the ability to 'flatten' properties from the input into primitive attributes. For example:

data = {
  lat: 12.34,
  lng: 56.78,
  info: {
    name: 'Johnny Goode',
    age: 12
  }
}

GeoJSON.parse(data, {Point: ['lat', 'lng'], include: ['name']});

There is currently no way to get the 'name' property as an attribute of the resulting GeoJSON object.

In an attempt to avoid breaking existing logic, I think this may be a good solution:

function getPropFunction(params) {
  ...
  else if (params.extract) {
    func = function(properties) {
      ...
    }
  } else if (params.include) {
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions