Skip to content

How to process geoJSON structures ? #4

Open
@wolfgangvonludwigsburg

Description

@wolfgangvonludwigsburg

Hi Ahmed,
I would like to process geoJSON structures, like so:

    const json = {
        "features": [
            {
                "type"          : "Feature",
                "properties"   : {
                    "str_schl"     : "02505",
                    "baumgruppe"   : "Tilia"
                },
                "geometry"     : {
                    "type"         : "Point",
                    "coordinates"  : [ 7.612346614095637, 51.974634186495123 ]
                }
            },
            {
                //2nd flat record included for test purposes ..
                "type"          : "Feature",
                "str_schl"     : "02505",
                "lat"          : 51,
                "lon"          : 7
            }
        ]
    }

    //
    Q = Q.reset()
    const features = Q.from( 'features' )
        .where( 'properties.str_schl'   , '=', '02505' )    //? no success
      //.where( 'coordinates.0'         , '=', 7 )          //? no success

      //.where( 'type'                  , '=', 'Feature' )  //OK, flat found
      //.where( 'str_schl'              , '=', '02505' )    //OK, flat found
      //.where( 'lat'                   , '>', 50 )         //OK, flat found
      //.where( 'lon'                   , '<', 8 )          //OK, flat found
        .fetch()
    console.log('-------- features from where ---------')
    features.forEach( feature=>console.log( feature ) )

May I ask:
(1) How can I access "deep" keys like "str_schl" within "properties" : .. ?
(2) or getting "coordinates" i.e. [lon, lat] within "geometry": .. ?

For any advice/hints
thanks in advance
Wolfgang

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