mapnik/node-mapnik — Issue #67: examples/tile/lib/utility.js fails to parse url
Author: wetnun
Created: 2011-10-11 23:14:04+00:00
State: open

[root@ii83-2 (16:10:59) /local/node-mapnik/examples/tile/lib]# node -v
v0.4.12

The default code only has one "match" which is the full string "0/0/0". I changed it to this and it works fine for me now:

5 coordreg = /(-?\d+)\/(-?\d+)\/(-?\d+)/g;
6 coords = coordreg.exec(req.url);
7 if (coords && coords.length == 4) {
8 try {
9 var x = parseInt(coords[2]);
10 var y = parseInt(coords[3]);
11 var z = parseInt(coords[1]);

It also handles my client passing in negative numbers properly.