Closed pstorch closed 8 years ago
Hi Peter,
It would be nice if Android had a double-based point object, but it looks like it doesn't. You could use PointF, but you you might run into accuracy problems, depending on the resolution you need.
I think I'd just create my own Point2D class, it's pretty simple - double x, y member variables and some geometry functions. Then modify LatLonPoint to extend from that instead.
Hi Don,
thanks for the suggestion. I first thought about just adding some new methods with a double array instead of the LatLonPoint class. Just to not change to much of the rest of the code of openmap. But maybe it's better to build a replacement for the Point2D class. I'll try.
Hi Don,
I tried to "copy" the java.awt.geom.Point2D
class from the java sources into the openmap sources and started changing all classes referencing the awt version with the openmap version. But then I had to copy the java.awt.Point
class as well. I ended up in changing lots of classes in the openmap codebase up to the UI classes which need to have the awt version. Then I had to convert back and forth between the two. At that point I stopped. I think this doesn't make sense this way for the openmap project. It's too much intertwined with the UI logic.
I have to think about it some more.
Oh, sorry, I thought you were pulling the UTMPoint class and the other couple of classes out of the OpenMap package to integrate with your stuff.
Yeah, trying to pull Point2D and Point out of OpenMap in general would be rather daunting. There are some generic packages (like proj, geo) that would be generally useful outside of OpenMap, and it wouldn't be too painful to pull what you need create a separate code base. But modifying anything tied to rendering would definitely have a rippling effect.
Our intention was to use openmap as a library in our project. We didn't want to reuse it by copy&paste the code ;) I've done a change to openmap which would be compatible (https://github.com/pstorch/openmap/tree/31_utm_conversion_without_java_awt). It uses a double array (for lat/lon) in some places where originaly only the LatLonPoint class was supported. But it duplicates some of the original methods and doesn't really fit in the original design. I think it's better to extract the needed classes from openmap and copy them into our codebase or a separate utility library and adjust it as needed (if this is ok with the openmap license). If you like, you can close the issue.
On Monday I can send a library I have implemented following maths found on movabletypes site that can perform lat lon to utm conversion. Still need to implement reverse... From utm to lat lon...
Il 29 lug 2016 10:20 PM, "Peter Storch" notifications@github.com ha scritto:
Our intention was to use openmap as a library in our project. We didn't want to reuse it by copy&paste the code ;) I've done a change to openmap which would be compatible ( https://github.com/pstorch/openmap/tree/31_utm_conversion_without_java_awt). It uses a double array (for lat/lon) in some places where originaly only the LatLonPoint class was supported. But it duplicates some of the original methods and doesn't really fit in the original design. I think it's better to extract the needed classes from openmap and copy them into our codebase or a separate utility library and adjust it as needed (if this is ok with the openmap license). If you like, you can close the issue.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenMap-java/openmap/issues/31#issuecomment-236283442, or mute the thread https://github.com/notifications/unsubscribe-auth/AJYth3fl3X72f5iciV3D9z6Mau91C6coks5qamCCgaJpZM4JTqQ4 .
I agree your best option is to use the OpenMap code to create classes you need in your package. The license provides you with options on how to do that (the easiest being to change the code so it can't be confused with the OpenMap version and toss a little credit to the project in your about page).
Cheers
We (from the https://github.com/cgeo/cgeo project) are looking for an UTM (MGRS) conversion library which we can use in our Android app (see Issue https://github.com/cgeo/cgeo/issues/1914). After some research we found openmap and tried integrating it in cgeo (see https://github.com/cgeo/cgeo/pull/5823). We successfully converted from latitude/longitude to UTM, but we would also like to parse UTM and convert it to lat/lon. Unfortunately the
LatLonPoint
class inherits fromjava.awt.Point2D
which is not available on Android. Do you see any possibility to use the UTM conversion code outside of openmap without thejava.awt.Point2D
dependency? Any suggestion is appreciated. I'll also try to look into the openmap code. Maybe I find a way to accomplish this. Then I'll let you know. Thanks in advance.