|
18 | 18 | public class EntryPoint { |
19 | 19 |
|
20 | 20 | public static void main(String[] args) throws ClassNotFoundException, URISyntaxException, IOException { |
21 | | - // Some java black magic to load the interned jar |
22 | | - URL mapnikJniJar = EntryPoint.class.getResource("/lib/mapnik-jni.jar"); |
23 | | - URLClassLoader child = new URLClassLoader(new URL[] { mapnikJniJar }, EntryPoint.class.getClassLoader()); |
24 | | - Class.forName("mapnik.Mapnik", true, child); |
25 | 21 |
|
26 | 22 | Mapnik.initialize(); |
27 | | - |
28 | | - Box2d bounds = new Box2d(5.91478, 45.56237, 5.92904, 45.56921); |
| 23 | + // France métropolitaine |
| 24 | + // -9.86 41.15 |
| 25 | + // 10.38 51.56 |
| 26 | + Box2d bounds = new Box2d(-9.86, 41.15, 10.38, 51.56); |
29 | 27 | MapDefinition m = new MapDefinition(); |
30 | 28 |
|
31 | | - URL myMapFile = EntryPoint.class.getResource("/data/simplemap.xml"); |
| 29 | + URL myMapFile = EntryPoint.class.getResource("/data/france.xml"); |
32 | 30 | // This should be done by the initialize() call, but ... |
33 | 31 | FreetypeEngine.registerFonts(Mapnik.getInstalledFontsDir(), true); |
34 | 32 |
|
35 | 33 | m.loadMap(new File(myMapFile.toURI()).getAbsolutePath(), false); |
36 | 34 | m.setSrs(Projection.LATLNG_PARAMS); |
37 | | - m.resize(512, 512); |
| 35 | + m.resize(4096, 4096); |
38 | 36 | m.zoomToBox(bounds); |
39 | 37 |
|
40 | | - Image image = new Image(512, 512); |
| 38 | + Image image = new Image(4096, 4096); |
41 | 39 | Renderer.renderAgg(m, image); |
42 | 40 |
|
43 | 41 | byte[] contents = image.saveToMemory("png"); |
44 | 42 | image.dispose(); |
45 | 43 | m.dispose(); |
46 | 44 |
|
47 | | - FileOutputStream fos = new FileOutputStream("chambery.png"); |
| 45 | + FileOutputStream fos = new FileOutputStream("france.png"); |
48 | 46 | fos.write(contents); |
49 | 47 | fos.flush(); |
50 | 48 | fos.close(); |
|
0 commit comments