Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to process geoJSON structures ? #4

Open
wolfgangvonludwigsburg opened this issue Nov 13, 2024 · 0 comments
Open

How to process geoJSON structures ? #4

wolfgangvonludwigsburg opened this issue Nov 13, 2024 · 0 comments

Comments

@wolfgangvonludwigsburg
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant