GoogleCloudPlatform / bigquery-geo-viz

Visualize Google BigQuery geospatial data using Google Maps Platform APIs
https://bigquerygeoviz.appspot.com/
Apache License 2.0
107 stars 38 forks source link

Query hangs if geom is null #4

Closed intotecho closed 4 years ago

intotecho commented 5 years ago

The app just hangs as the query doesn't return. I have to reload the page and start over. The app gets to prequery OK.

The issue occurs when the app detects a geometry column, but the geometry of a row evaluates to null.

Console printout:

TypeError: feature.geometry is null
map.component.ts:132:6
    updateFeatures map.component.ts:132
    forEach self-hosted:262
    updateFeatures map.component.ts:131
    set map.component.ts:67
    Angular 6
    View_MainComponent_0 MainComponent.html:16
    Angular 5
    query main.component.ts:242
    r2 cb=gapi.loaded_0:127
    xs cb=gapi.loaded_0:130
    Wq cb=gapi.loaded_0:130
    uea cb=gapi.loaded_0:130
    Ap cb=gapi.loaded_0:122
    Angular 9

An error handler here would be a nice enhancement.

The app will guess the geometry column. Usually there will only be one column that is a sensible candidate.

Workaround

By adding a filter to the query, along the lines of gem is not null, the problem is averted and the query renders fine.

mentin commented 4 years ago

I think this can also be handled by GeoViz when it creates the wrapper query in order to call ST_AsGeoJson(). It can add ' WHERE geo-field IS NOT NULL ' to the wrapper query. This would also avoid transmitting rows that GeoViz has no way to use.

hormati commented 4 years ago

This is fixed now.