Open ARolek opened 7 years ago
Would it be enough to:
geometry_type=point|linestring|polygon|multipoint|multilinestring|multipolygon
tegola/postgis.go
function layerGeomType
check if geometry_type is specified, if so - use geometry type from there, otherwise - do the "old" logic - replace _stasbinary to _stgeometrytype and execute the query.@tomass
Are you interested in helping with some research?
@ARolek yes, I'm interested. @paumas has already done some research on this:
layerGeomType
function gives warning in different places where geometry type is used (like displaying list of layers provided and generating all.json info), but vector tiles are rendered just fine.@tomass
If we were to remove auto sniffing the geometry type we could purge a bunch of complex code. It might be best overall to have the user define the geom type in the config file instead of sniffing for it, the downside being more work required by the end user.
Code for sniffing is already there. So maybe both methods could be supported? Somebody could then specify geometry type only for advanced usage (like returning WKB pre-calculated in materialized view or similar). Leaving the sniffing code would also remove the necessity to update the config after upgrading Tegola. But it is up to you to decide.
@tomass my initial plan was to support both. The logic would essentially be:
geom_type
no sniffing is necessary on that layer.geom_type
sniff for the geom type. If it's not possible to infer report a warning to the console with the suggestion to add the geom_type
config param for that layer.This would need to be implemented for both PostGIS and GeoPackage data providers.
The
ST_AsBinary(geom)
requirement in SQL statements is a wart that I would like to get rid of. The underlying postgres driver (pgx) supports binary transfer protocol. We should be able to fetch request using the binary protocol rather than the text protocol to remove this wart.When this task is worked on, make sure to address the outstanding TODO here.