Closed abdelhameedhamdy closed 5 years ago
Can you elaborate?
I have a table with polygons when trying to add a new polygon as illustrated below
Then trying to add it in mapbox as vector layer (mvt), I got the following behavior when trying to zoom to the new feature as illustrated
And the same thing happens for points layer, as illustrated below :
And as you see the new added points does not show properly when trying to zoom in/out and pan
after several minutes (15 ~ 30 mins), the new added features renders properly I don't know why, is it something related to caching or something !!
The same thing happens when deleting records from the table, it takes a lot of time till the new change reflects to mvt ..
Thanks for the clarification.
By default (see cache
option in config), output is set to cache in the browser for an hour. Your browser is showing you tiles it has cached rather than re-fetching them. You could change the cache value in config to a much smaller amount (it's in seconds) or zero if you want the browser to request new tiles more often.
To check it, if you're using Chrome, you can go to your dev tools (CTRL-SHIFT-J), go to the Network tab, and click Disable cache, and refresh your browser window (leaving the dev tools open).
Cache is a performance option for the client and server, so use your best judgement tuning that for your needs.
Thanks for your reply,
When disabling the cache either from dirt config, or from the browser, And doing a change (insert/delete records) in postgis table, requires refreshing the whole page, the normal behavior of dynamic layer is whenever a change occurs in the table it should be reflected directly on the map on just panning/zooming event in the map itself without refreshing the whole web page.
What do you think !
To do that in an efficient way, you'd have to use HTTP2 and leverage the Web Push API on the server, then register a listener via service workers on the client. Then you'd have to use Postgres' notify tooling with add/update/delete hooks on your table so Postgres can let the web server know something changed. It's possible, but it's definitely non-trivial.
The other option is a lot more inefficient (read: your server and clients will have to work much harder), but you could have the client refresh from the source on a timer, like this. This is very inefficient, as the client will have to continuously refresh the map tiles regardless of whether anything has changed or not. But if you want "live" or something near that, it's the easiest way to go.
Hope that helps!
Got it, thanks anyway.
Hi,
I tried two tables with two feature types polygon and points, and used the mvt route with mapbox gl js,
when trying to render the mvt layer, it shows but encounters some discontinuity while rendering on the map,