Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save springmeyer/9675391 to your computer and use it in GitHub Desktop.

Select an option

Save springmeyer/9675391 to your computer and use it in GitHub Desktop.
AGG line-join:round triangle artifacts bug testcase
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Style name="contour">
<Rule>
<Filter>[ele]=2330</Filter>
<LineSymbolizer stroke="#000000" offset="1" clip="false" stroke-width="1" stroke-linejoin="round" />
</Rule>
</Style>
<Layer name="contour"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>contour</StyleName>
<Datasource>
<Parameter name="type">ogr</Parameter>
<Parameter name="file">merc.json</Parameter>
<Parameter name="layer">OGRGeoJSON</Parameter>
</Datasource>
</Layer>
</Map>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Style name="contour">
<Rule>
<Filter>[ele]=2330</Filter>
<LineSymbolizer stroke="#000000" offset="1" clip="false" stroke-width="1" stroke-linejoin="round" />
</Rule>
</Style>
<Layer name="contour"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>contour</StyleName>
</Layer>
</Map>
{
"name" : "vtile-test",
"main" : "./vtile-mem.js",
"dependencies" : {
"mapnik":"1.4.x",
"queue-async":"*",
"bytes":"*"
}
}
var fs = require('fs');
var zlib = require('zlib');
var bytes = require('bytes');
var mapnik = require('mapnik');
mapnik.register_default_fonts();
function vtile() {
var map = new mapnik.Map(256,256);
map.loadSync('./original.xml');
var filename = '14_10083_6161.vector.pbf.z';
var data = fs.readFileSync(filename);
zlib.inflate(data, function(err, buf) {
if (err) throw err;
var parts = filename.split('_');
var z = +parts[0];
var x = +parts[1];
var y = +(parts[2].split('.')[0]);
var vt = new mapnik.VectorTile(z,x,y);
vt.setData(buf);
var im = new mapnik.Image(256,256);
vt.parse(function(err) {
if (err) throw err;
fs.writeFileSync('out.json',JSON.stringify(vt.toGeoJSON(1),null,1));
vt.render(map, im, {buffer_size:0}, function(err,image) {
if (err) throw err;
image.save('out.png',"png24")
});
});
});
}
function normal() {
mapnik.register_default_input_plugins();
var map2 = new mapnik.Map(256,256);
map2.loadSync('./json.xml');
map2.extent = [4625357.4555925857275724,4965349.357405048795044,4627803.4404977113008499,4967795.3423101771622896];
map2.render(new mapnik.Image(256,256),function(err,im) {
if (err) throw err;
im.save('out2.png',"png24");
});
}
//normal()
vtile()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment