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

Use arrays for center and bounds in tilejson #57

Merged
merged 2 commits into from
Dec 11, 2014
Merged

Conversation

pnorman
Copy link
Contributor

@pnorman pnorman commented Dec 10, 2014

Fixes #4

This does not validate that the parameter in the Mapnik XML is valid,
but if it is valid, it will result in a valid TileJSON.

cc @zerebubuth

Fixes #4

This does not validate that the parameter in the Mapnik XML is valid,
but if it is valid, it will result in a valid TileJSON.
@@ -2,7 +2,8 @@
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
<Parameters>
<Parameter name="metatile">1</Parameter>
<Parameter name="center">-75.6038,40.0799,11</Parameter>
<Parameter name="center">-75,40,11</Parameter>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any significance to making the center values all integers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - just a shorter output in the tests

@@ -216,7 +219,11 @@ std::string make_tilejson(const mapnik::Map &map,

for (auto const &row : params) {
out << "\"" << row.first << "\":";
mapnik::util::apply_visitor(json_converter(out), row.second);
if (array_keys.count(row.first) > 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better than array_keys.find(row.first) == array_keys.end?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's effectively the same (well, with !=), but I think it's more readable.

@zerebubuth
Copy link
Contributor

Looks good, :shipit:

pnorman added a commit that referenced this pull request Dec 11, 2014
Use arrays for center and bounds in tilejson
@pnorman pnorman merged commit 30ab719 into master Dec 11, 2014
@pnorman pnorman deleted the tilejson_array branch May 19, 2015 06:19
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

Successfully merging this pull request may close these issues.

Return tilejson
2 participants