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

Move on to Mapnik 3.x #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Move on to Mapnik 3.x #9

wants to merge 8 commits into from

Conversation

jlnr
Copy link

@jlnr jlnr commented Aug 21, 2015

I'm trying to render OSM tiles from Java on Windows and OS X. I couldn't get mapnik-jni to link on Windows at first (same error as in issue #3), and when I did, things crashed as soon as I zoomed to an area that actually contained anything.

So I've adapted mapnik-jni to work with Mapnik 3; specifically, Mapnik 3.0.1 from Homebrew on OS X, and the 64-bit Mapnik 3.0.2 SDK for Windows linked to from this comment: mapnik/mapnik#3014 (comment)
(I can send a separate Pull Request for my MSVC 2015 project if this PR looks okay to you.)

All tests pass and everything works fine for me, but so far I've only loaded maps from XML and rendered them to PNG, so it is entirely possible that I've broken every other class on my way.
I'll comment on the commits in this PR about which I feel a little uneasy. Also, I haven't added any #ifdef magic to keep this compatible with Mapnik 2.x.

@@ -5,9 +5,9 @@
<target name="compile">
<mkdir dir="build/classes"/>
<mkdir dir="csrc"/>
<javac srcdir="src" destdir="build/classes" debug="on" source="1.5" target="1.5" includeantruntime="false"/>
Copy link
Author

Choose a reason for hiding this comment

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

I've only actually tested this with Oracle's Java 8 VM on both OS X and Windows, which complained about source="1.5" (warnings). Maybe it would be better to update this to 1.8 or drop the source parameter altogether? I am not an Ant or JVM expert.

@pmauduit
Copy link

Hi, I'm very interested in this PR because I'm willing to generate a debian package (which provides a mapnik 3.x version of the library in the unstable version of the distribution), so that I can use it easily in a java project, any news so far ? May I help ?

FYI, trying to build, I got the following error:

     [exec] mapnikjni.cpp:11:31: fatal error: mapnik/graphics.hpp: No such file or directory

@jlnr
Copy link
Author

jlnr commented Jan 28, 2016

(EDIT: snipped misleading section; leaving the bottom half of this comment because it might still be a good idea)

I guess it would be cleaner and fix your compiler bug to change the csrc/Makefile.{osx,linux} to use mapnik-config --cflags instead, in the same way that the Makefiles already use mapnik-config --ldflags. If you successfully patch Makefile.linux and let me know the diff, I'll push it into this PR too, in the hopes that it will eventually be merged.

@pmauduit
Copy link

Strange, I don't have the file graphics.hpp in my include directory, using the 3.0.9 dev package:

% dpkg -l | grep ii | grep mapnik 
ii  libmapnik-dev                          3.0.9+ds-1                             amd64        C++ toolkit for developing GIS applications (devel)

I'll dig in further ...

@jlnr
Copy link
Author

jlnr commented Feb 2, 2016

Hey @pmauduit. Sorry for being completely misleading in my earlier comment. There is no mapnik/graphics.hpp in Mapnik 3, but it did exist in Mapnik 2. You are probably compiling a checkout of this repository, not my fork. Compare mapnikjni.cpp here:

https://github.com/springmeyer/mapnik-jni/blob/master/csrc/mapnikjni.cpp#L11

with the file in my branch:

https://github.com/jlnr/mapnik-jni/blob/mapnik-3/csrc/mapnikjni.cpp#L11

Hope that helps.

@pmauduit
Copy link

pmauduit commented Feb 3, 2016

I was pretty sure to compile against your current branch, but I guess it deserves a triple-check :-) I will dig in further ASAP.

@pmauduit
Copy link

pmauduit commented Feb 6, 2016

I actually was on the good branch, but with some probable autogenerated files from previous trials onto the master one ... After everything cleaned up, I was able to compile.

There is a failing test though revealed by make test, but haven't been further yet:

    [junit] Test mapnik.TestLayer FAILED

I did a sample Java app that generates my hometown's highways as png, and it works like a charm ; now struggling with the specific debian packaging stuff :)

@jlnr
Copy link
Author

jlnr commented Feb 7, 2016

If I'm not mistaken then one of the tests required me starting a PostGIS server in order to pass. That might be it.

The sweet irony of an ASSERT() helper causing so much trouble :)

`long` is 32-bit even on 64-bit Windows:
https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx
@Andy511823558
Copy link

How do I get the 'mapnik-jni.dll'? Thanks!

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.

3 participants