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

Wrong values for !pixel_width! and !pixel_height! #1937

Closed
strk opened this issue Jul 3, 2013 · 8 comments
Closed

Wrong values for !pixel_width! and !pixel_height! #1937

strk opened this issue Jul 3, 2013 · 8 comments

Comments

@strk
Copy link
Contributor

strk commented Jul 3, 2013

Theoretically the tokens should give the size of a pixel in geographical units.
Instead they seem to be giving 1/size_of_output_in_pixel.

I'm surprised it went unnoticed for all this time, or could it be that the semantic of query.resolution changed ? See #1181

@strk
Copy link
Contributor Author

strk commented Jul 3, 2013

I'm trying to fix this but get_bbox().width() returns 0 and !scale_denom! is also zero, how can that be ?
Shouldn't the actual datasource extent be available at time of postgis_datasource::features call ?

@strk
Copy link
Contributor Author

strk commented Jul 3, 2013

Never mind, I was using a silly extent value (indeed 0-sized)

@strk
Copy link
Contributor Author

strk commented Jul 3, 2013

With a proper extent it looks like my computation for !pixel_width! and !pixel_height! end up being 10x bigger than scale_denom, why is so ? What's the meaning of scale_denom ?

@strk
Copy link
Contributor Author

strk commented Jul 4, 2013

Also, what's the meaning of query.resolution ? It works pretty much as I'd expect when the layer input is latlon and the output projection is webmercator (ie: it gives about output_size / latlon_extent) but if I set the same projection for layer and map then resolution starts giving wild values like 6e-6 while rendering italy, independently on the advertised layer extent.

All I'd need is the extent of the layer, in layer projection, the extent of the map, in map projection and the size of the output image.

@strk
Copy link
Contributor Author

strk commented Jul 4, 2013

Also, note to self (thanks @springmeyer), the scale_denominator variable is another weird thing:
https://github.com/mapnik/mapnik/blob/master/src/scale_denominator.cpp#L36

@strk
Copy link
Contributor Author

strk commented Jul 4, 2013

Ok, I know how to get to the layer extent, so what I'm missing now is the map extent (in map projection) and the output image size

@strk
Copy link
Contributor Author

strk commented Jul 4, 2013

After further analisys I can't confirm those values are broken. At least not in normal conditions.
But there seem to be some conditions that break it. I'm seeing them break at zoom levels > 28

@strk
Copy link
Contributor Author

strk commented Jul 4, 2013

Alright, closing this one as invalid, the values are correct,the problem is elsewhere

@strk strk closed this as completed Jul 4, 2013
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

1 participant