koopjs / winnow

Deprecated
Apache License 2.0
90 stars 18 forks source link

Offset seems broken #29

Closed efbenson closed 7 years ago

efbenson commented 7 years ago

https://github.com/FeatureServer/winnow/blob/master/src/executeQuery.js#L38

when you use the query as a filter per feature an offset in the sql query like: SELECT type, properties as attributes, esriGeom(geometry) as geometry FROM ? LIMIT 100 OFFSET 1 will skip each feature

So if the feature query is returning 50 features and you add 1 resultOffset you will get no features.

I would think 1 of two things would need to happen A) load all features in and apply the query or B) remove the offset from the query and do it in post processing of the results in winnow

thomas-hervey commented 7 years ago

@efbenson, #31 should handle this issue. The included test should cover your condition.

dmfenton commented 7 years ago

thanks for sharing @efbenson. Would you mind sharing how you're using this project?

thomas-hervey commented 7 years ago

@efbenson, this should be handled in v1.12.1.

efbenson commented 7 years ago

Sorry for the delay. Yeah we use it to expose our data out of our SASS product. We have our own provider that hooks into our microservice architecture and issues queries in our own DSL that pulls data from a mix of databases/caching. Most of its mongo based but the queries are not mongo. We have rolled our own security to AGOL security interop into koop as well. So we are able to use a single endpoint for different AGOL orgs.

efbenson commented 7 years ago

Thanks @tomtom92

dmfenton commented 7 years ago

We have rolled our own security to AGOL security interop into koop as well. So we are able to use a single endpoint for different AGOL orgs.

That's awesome! Is it open source?

efbenson commented 7 years ago

Its a horrible hack. But I think at some point I can pull it out and make it a PR to koop. Reverse engineering the sequence of urls AGOL hits on ArcServer for auth was quite the task. As we harden this up a bit more of the next couple of months I think we will get a refactoring of that done and I should be able to extract that out. I might have to work a bit more heavily with the koopcore and featureserver repos maintainers to figure out the best place for that.

tl;dr; not open source but we would like to contribute back

here's a rough layout of the urls the provider handles:

route templates are per feature layer routes are for emulating the AGOL registration process for auth

TBH I might not be doing the feature layers correctly there was not a ton of docs or examples for rolling your own provider. But it works.

const routeTemplates = [
    {
        path: '/arcgis/rest/services/koop/{service}/FeatureServer/:layer/:method',
        methods: ['get', 'post'],
        handler: 'featureServerProxy'
    },
    {
        path: '/arcgis/rest/services/koop/{service}/FeatureServer/layers',
        methods: ['get', 'post'],
        handler: 'featureServerProxy'
    },
    {
        path: '/arcgis/rest/services/koop/{service}/FeatureServer/:layer',
        methods: ['get', 'post'],
        handler: 'featureServerProxy'
    },
    {
        path: '/arcgis/rest/services/koop/{service}/FeatureServer',
        methods: ['get', 'post'],
        handler: 'featureServerProxy'
    },
    {
        path: '/arcgis/rest/services/koop/{service}/geojson',
        methods: ['get', 'post'],
        handler: 'geoJsonProxy'
    }
]

const routes = [
    {
        path: '/arcgis/rest/info',
        methods: ['get'],
        handler: 'restInfo'
    },
    {
        path: '/arcgis/rest/services',
        methods: ['get'],
        handler: 'restServices'
    },
    {
        path: '/arcgis/rest/services/koop',
        methods: ['get'],
        handler: 'koopListing'
    },
    {
        path: '/arcgis/sharing/generateToken',
        methods: ['get', 'post'],
        handler: 'login'
    },
    {
        path: '/arcgis/sharing/generateToken/generateToken',
        methods: ['get', 'post'],
        handler: 'login'
    }

];