Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some geometry is not redenderer #1

Open
javisantana opened this issue Apr 2, 2012 · 12 comments
Open

some geometry is not redenderer #1

javisantana opened this issue Apr 2, 2012 · 12 comments

Comments

@javisantana
Copy link
Contributor

Some geometry is not renderer in some tiles, for example the west canada

http://vizzuality.github.com/VECNIK/examples/custom_renderer.html#2/0.0/62.4

@strk
Copy link

strk commented Apr 2, 2012

Does the code handle exceptions ? Any way to look at them ? I guess ST_Intersection or even ST_MakeValid may be throwing an exception

@javisantana
Copy link
Contributor Author

No exceptions, all request to SQL look valid (valid geojson).

At zoom level 2 there are problems with tiles (2, 1, 1) and (2, 0, 1). In both tiles there are geometry rendered (so some geometry is returned from the sql api for that tile)

I've updated and pushed the tile_sql tool you used in the previous prototype. The sql for that tiles is:

http://viz2.cartodb.com/api/v2/sql?q=select%20cartodb_id%2CST_Intersection(CASE%20WHEN%20ST_Dimension(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.17578125)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%200.3515625)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)%2C%200.703125)%2C0.3515625)%2C%200.3515625))%20%3D%200%20OR%20GeometryType(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.17578125)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%200.3515625)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)%2C%200.703125)%2C0.3515625)%2C%200.3515625))%20%3D%20'GEOMETRYCOLLECTION'%20THEN%20ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.17578125)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%200.3515625)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)%2C%200.703125)%2C0.3515625)%2C%200.3515625)%20ELSE%20ST_CollectionExtract(ST_MakeValid(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.17578125)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%200.3515625)%2C%20ST_Dimension(%20%22the_geom%22)%20%2B%201%20)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)%2C%200.703125)%2C0.3515625)%2C%200.3515625))%2C%20ST_Dimension(%22the_geom%22)%20%2B%201%20)%20END%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)%2C%200.703125)%2C0.3515625))%20as%20the_geom%20from%20countries_export_2%20WHERE%20the_geom%20%26%26%20ST_MakeEnvelope(-90%2C0%2C0%2C66.51326044311185%2C%204326)&format=geojson&dp=6

@strk
Copy link

strk commented Apr 2, 2012

Ah, I see ST_SnapToGrid is involved. That function would still turn collapsed polygon into EMPTY elmements. Try taking ST_SnapToGrid out ?

@strk
Copy link

strk commented Apr 2, 2012

BTW, I don't really see the missing geometries from the custom renderer example. But I do see what looks like a completely missing tile on the east of Canada.

@javisantana
Copy link
Contributor Author

yep, you are right, is east not west, sorry. But if you play a little bit with whatever tool you use for debugging web apps (firebug, chrome developer tools...) you can see that there are no missing tiles, all tiles render geometry.

@strk
Copy link

strk commented Apr 2, 2012

Would be useful to be able to overlay the correct and bogus layers to see exactly what's missing.
Anyway I suggest you try removing the ST_SnapToGrid call.

Does vecnik repo replace cartodb_tile_render one or integrates it ?

@javisantana
Copy link
Contributor Author

"""
Would be useful to be able to overlay the correct and bogus layers to see exactly what's missing.
Anyway I suggest you try removing the ST_SnapToGrid call.
"""
don't tell it, do it :)

new one using some code from cartodb_tile_render.

@strk
Copy link

strk commented Apr 2, 2012

I was thinking: could it be your client-side clipping introducing the problem ? I'm pretty sure I've seen missing geometries also before the SQL part was changed. I know it's not easy to "clip" vectors not intersecting the clipper range (all covered and all within hole cases) -- If you have a way to disable clipping it should be easy to tell.

About doing: my TODO list is growing exponentially, worth discussing some before going into implement things. I shall point out that I'd give precedence to implement an OpenLayers layertype if I had to touch JS for VECNIK, that way it'd have layer management for free :)

@javisantana
Copy link
Contributor Author

dont worry @strk it is better to solve it myself :) (there is no client side clipping btw)

@javisantana
Copy link
Contributor Author

openlayers FTW !!

@strk
Copy link

strk commented Apr 3, 2012

I just had another thought: can it be a winding issue ? Ie: something that would be fixed by a call to ST_ForceRHR.

@wboykinm
Copy link

I've got an addendum to this issue; one of my Vecnik-ModestMaps implementations has also gotten selective about which tiles it renders. There's a few missing at each zoom level, and it seems to be the same error pattern on Chrome, FF and Safari.

Was there an easy resolution on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants