tobinbradley/dirt-simple-postgis-http-api

Unimplemented type: 3

Closed this issue · 4 comments

Hi - awesome project, well done!

Have you ever come across this?

My gut feeling is that it has something to do with Multi* geom types, however, not quite sure yet...

Cheers

What were you doing when you saw the error? Was it a particular service? Was the error in the return or did it come from node on the command line?

I was trying to consume the MVT tiles in https://github.com/erikandre/mapbox-gl-style-editor which is basically a MapBox GL JS viewer.

I've dug a bit deeper and it looks like that the source of the mysterious Uncaught Error: Unimplemented type: 3 is an caused by an also mysterious response from dirt:

{
  "error": "error running query",
  "error_details": {

  }
}

The node console (CLI) is clean.

I don't think the message you're seeing is harming anything on the GL end of things. Seems to get this if you request a tile for which the layer you called via dirt has no data (empty recordset from Postgres). I can pan to areas my layer isn't and see that error, then pan to areas I do have data it draws fine.

That being said, it's annoying. My best guess is geojson-vt, dbgeo, or vt-pbf doesn't like the fact it is being passed an empty record set and is throwing an error. I'll see if I can figure out how to pass an empty vector tile back in those cases so Mapbox doesn't whinge about it. Thanks for letting me know!

Just to make sure nothing else is going on, maybe sure your source looks something like this:

"dirt": {
          "type": "vector",
          "tiles": [
            "http://localhost:8123/mvt/v1/tax_parcels/{z}/{x}/{y}?geom_column=geom&columns=pid"
          ],
          "maxzoom": 14,
          "minzoom": 14
        }

And your layer looks something like this:

{
            "id": "myspankylayer",
            "type": "fill",
            "source": "dirt",
            "source-layer": "tax_parcels",
            "paint": {
                "fill-color": {
                    "base": 1,
                    "stops": [
                        [
                            15.5,
                            "#f2eae2"
                        ],
                        [
                            16,
                            "#dfdbd7"
                        ]
                    ]
                }
            }
        }

Looks like MapBox responds with a 404 in those situations: see issue. More polite than an error message I suppose, and the error message GL gives is more intuitive (though it still whinges about it).

Done - see f19ade6