koopjs / winnow

Deprecated
Apache License 2.0
90 stars 18 forks source link

When returnGeometry is false and outSR is 102100 winnow throws an error #94

Closed efbenson closed 6 years ago

efbenson commented 6 years ago

It seems contradictory to have them both sent, but AGOL does it when opening the grid of a layer in the map viewer and it throws a modal error.

image

I console dir'ed the params for esrify and properties are null.

This is a regression at some point, it was working a before at 1.12.5


{ properties: undefined,
  geometry: undefined,
  dateFields: '',
  requiresObjectId: 'true',
  idField: 'OBJECTID' }
Trace: TypeError: Cannot read property 'OBJECTID' of undefined
    at Object.esriFy (F:\proj\htrack\src\mapping-api\node_modules\winnow\dist\sql.js:155:38)
    at alasql.Query.eval [as selectfn] (eval at yy.Select.compileSelect2 (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:9734:9), <anonymous>:3:40)
    at doJoin (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:7461:27)
    at doJoin (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:7545:8)
    at queryfn3 (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:6963:2)
    at queryfn2 (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:6937:9)
    at Object.eval [as datafn] (eval at <anonymous> (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:8415:20), <anonymous>:3:57)
    at F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:6885:19
    at Array.forEach (<anonymous>)
    at queryfn (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:6881:16)
    at statement (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:8026:14)
    at Function.alasql.dexec (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:4619:11)
    at Function.alasql.exec (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:4601:17)
    at alasql (F:\proj\htrack\src\mapping-api\node_modules\alasql\dist\alasql.fs.js:138:16)
    at standardQuery (F:\proj\htrack\src\mapping-api\node_modules\winnow\dist\executeQuery.js:34:18)
    at Object.Winnow.query (F:\proj\htrack\src\mapping-api\node_modules\winnow\dist\index.js:33:17)
    at query (F:\proj\htrack\src\mapping-api\node_modules\featureserver\dist\query.js:27:28)
    at execQuery (F:\proj\htrack\src\mapping-api\node_modules\featureserver\dist\route.js:36:16)
    at Object.route (F:\proj\htrack\src\mapping-api\node_modules\featureserver\dist\route.js:27:14)
    at F:\proj\htrack\src\mapping-api\node_modules\koop-output-geoservices\index.js:9:24
    at F:\proj\htrack\src\mapping-api\node_modules\koop\dist\models\index.js:15:9
    at route.then (F:\proj\htrack\src\mapping-api\lib\provider\model.js:40:13)
    at execQuery (F:\proj\htrack\src\mapping-api\node_modules\featureserver\dist\route.js:38:52)
    at Object.route (F:\proj\htrack\src\mapping-api\node_modules\featureserver\dist\route.js:27:14)
    at F:\proj\htrack\src\mapping-api\node_modules\koop-output-geoservices\index.js:9:24
    at F:\proj\htrack\src\mapping-api\node_modules\koop\dist\models\index.js:15:9
    at route.then (F:\proj\htrack\src\mapping-api\lib\provider\model.js:40:13)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
rgwozdz commented 6 years ago

Can you provide the full request URL issued by AGOL that leads to this error?

rgwozdz commented 6 years ago

@efbenson - can you provide steps to reproduce? I have

1) Started koop server 2) Add a FeatureServer item to AGOL 3) Opened the new AGOL item in MapViewer 4) Opened the layer's attribute table

I get no modal error with the steps above.

efbenson commented 6 years ago

I played with postman and was enabling and disabling each param. I found disabling returnGeometry being sent made it work, but returnGeometry by itself also worked. A bunch of requests later it was narrowed to the 2.

.../koop/htrack-lastPositions/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=dateTime%20ASC&outSR=102100&resultOffset=0&resultRecordCount=50
rgwozdz commented 6 years ago

I tested your query string with a Postman request to koop using the file-geojson provider. I had a successful response without any error. Are you setting metadata with your provider? If so, could you post? It's possible the issue may lie there.

efbenson commented 6 years ago

I got it, updating our koop version fixed it. With that I noticed errors with

WARNING: requested provider's metadata field "receivedTime (esriFieldTypeDate)" not found in feature properties)

Looking into it, we at some point probably 2 years ago we found setting the types as esri types in our meta data made AGOL work better, but I will play around with dropping back to the native types.

rgwozdz commented 6 years ago

It's just a warning, intended to let you know that you have set a metadata field named receivedTime that isn't showing up in the GeoJSON properties object (perhaps it's not being added in the translation function?). If that warning is showing up for unrelated reasons, please let us know. Thanks.