Skip to content

Instantly share code, notes, and snippets.

@keewon
Last active August 29, 2015 13:56
Show Gist options
  • Save keewon/8971592 to your computer and use it in GitHub Desktop.
Save keewon/8971592 to your computer and use it in GitHub Desktop.
Capturing NAVER Map with CasperJS
// install casperjs, phantomjs
var casper = require('casper').create();
casper.start('http://map.naver.com/?menu=location&mapMode=0&lat=37.3659794&lng=127.1152764&dlevel=14&enc=b64', function() {
this.viewport(5000, 5000);
this.wait(2000, function() {
this.capture('map.png', {
top: 0,
left: 0,
width: 5000,
height: 5000
});
});
});
casper.run();
var wh = 5000
/*
* http://map.naver.com/?menu=location&mapMode=0&lat=36.2652576&lng=126.8963396&dlevel=10&bicycle=on&enc=b64
http://map.naver.com/?menu=location&mapMode=0&lat=36.1537607&lng=127.0081414&dlevel=10&bicycle=on&enc=b64
*/
var lat_max = 36.26;
var lat_min = 36.15;
var lon_max = 127.01;
var lon_min = 126.89;
var casper = require('casper').create();
casper.start('http://map.naver.com', function() {
this.viewport(wh, wh);
});
var i = 0;
var j = 0;
var a = 0;
var b = 0;
for (i=lon_min; i<lon_max; i += 0.02) {
for (j=lat_min; j<lat_max; j += 0.02) {
(function (x, y, c, d) {
casper.thenOpen('http://map.naver.com/?menu=location&mapMode=0&lat=' + y + '&lng=' + x + '&dlevel=13&bicycle=on&cadastral=on&enc=b64' , function() {
casper.wait(8000, function() {
console.log(c + '_' + d);
this.capture('map' + c + '_' + d + '.png', {
top: 125,
left: 500,
width: wh - 40 - 500,
height: wh - 40 - 125
});
});
});
})(i, j, a, b);
b ++;
}
a ++;
b = 0;
}
casper.run();
@ragingwind
Copy link

npm 으로 만들어서 올려. npm install -g naver_map && naver_map -lat=37.123123 -lng 232323 -w 5000 -h 5000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment