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

aspect_fix_mode = 0 acting as ADJUST_BBOX_HEIGHT in WSG84 #885

Open
4ng37 opened this issue Jun 25, 2018 · 1 comment
Open

aspect_fix_mode = 0 acting as ADJUST_BBOX_HEIGHT in WSG84 #885

4ng37 opened this issue Jun 25, 2018 · 1 comment

Comments

@4ng37
Copy link

4ng37 commented Jun 25, 2018

When moving node-mapnik-sample-code from sphericalmercator to WSG84, the map has rendered as it had to adjusted the height.

postgis_settings = {
'srid' : '4326',
'table' : 'mytable' // has SRID 4326 anyway
}

var proj4 = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs';
// var proj4 = mercator.proj4;
var map = new mmapnik.Map(256, 256, proj4 );
var layer = new mapnik.Layer('tile', proj4 );

// var bbox = mercator.xyz_to_envelope(parseInt(params.x),parseInt(params.y),parseInt(params.z), false);
var bbox = tilebelt.tileToBBOX([parseInt(params.x),parseInt(params.y),parseInt(params.z)]);

map.aspect_fix_mode=8; // without this line, the coordinates are extended on height ...
map.extent = bbox; // ... when setting the map extent to the Bbox

I may have misused something, but setting aspect_fix_mode to 8 works fine, while leaving it to 0 changes the heigth coordinates

@lightmare
Copy link

First, use the named constants, not their values, in your code.

NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_GROW_BBOX",mapnik::Map::GROW_BBOX)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_GROW_CANVAS",mapnik::Map::GROW_CANVAS)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_SHRINK_BBOX",mapnik::Map::SHRINK_BBOX)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_SHRINK_CANVAS",mapnik::Map::SHRINK_CANVAS)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_ADJUST_BBOX_WIDTH",mapnik::Map::ADJUST_BBOX_WIDTH)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_ADJUST_BBOX_HEIGHT",mapnik::Map::ADJUST_BBOX_HEIGHT)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_ADJUST_CANVAS_WIDTH",mapnik::Map::ADJUST_CANVAS_WIDTH)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_ADJUST_CANVAS_HEIGHT",mapnik::Map::ADJUST_CANVAS_HEIGHT)
NODE_MAPNIK_DEFINE_CONSTANT(lcons->GetFunction(),
"ASPECT_RESPECT",mapnik::Map::RESPECT)

The default in mapnik is GROW_BBOX, which may act as ADJUST_BBOX_HEIGHT or ADJUST_BBOX_WIDTH depending on the dimensions that are to be adjusted. What you refer to as 8 is RESPECT which means no adjustment is made.

In short, working as intended.

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

2 participants