I have a task to develop an application with some GIS-functions: rendering of the previously downloaded map (with different layers and in different modes), programmatic assignment of markers and tracks, a path searching. It must be implemented under Android and PC (Win) and must be able to work offline. So I need a library which provides capabilities specified above and satisfies some additional conditions.
If possible, cross-platform (i.e. with a common core and with a different GUI under PC/Android).
Free for commercial use or without requirement of any user license in addition to the developer license.
Open-source is preferable (GPL/LGPL/MIT-like is ideal).
Java API is preferable.
After some days of googling I came to the conclusion that such a thing didn’t exist at all. There are many open-source GIS products in Java but no one of them is Android-compatible. So my goal is to find a library with an ability to render some map region into the picture and an ability to tell me coordinates by the specified picture pixel. At least I can use different PC-only and Android-only products to develop two different applications parallely.
Please, can anybody suggest me anything applicable for my task. Maybe somebody has some experience in this area. Any information is appreciated.
Thanks a lot.
Whilst not a full GIS library I have used JTS to write code on both PC and android.
The Website is http://www.vividsolutions.com/jts/JTSHome.htm
Whilst the documentation is a little on the light side I have found that it isn't to hard to implement. Using standard drawing functions I have been able to set up some basic GIS applications and mapping functions.
Related
For a side-project to learn web development and database management I decided I to make a radio-like website using the vast amount of TTA audio files that I have (along with the Cue files that complement them).
However, the biggest hurdle over this project has been, well, handling the audio itself. I'm not really sure how to go about decoding the TTA files and using that information to utilize the Cues properly.
I've been all over the Tau Projects website and just really at a loss on how to proceed. Some options I have considered, but not sure how they'd work/go about them.
1. Audio Library that Supports TTA
The easiest solution if one exists. From the very few audio libraries that exist for Java (at least that I know exist) none of them support the TTA format. If I am mistaken, please correct me.
2. Using JNI/JNA to Hook into Decoders
The Tau Projects has a list of downloads for various plugins and I assume implementations for encoders/decoders (like ttaenc-win). Now I do not know much about anything for C/C++ so this may come as a challenge for me to use. From what I can understand about the libtta++ download is it's just a bunch of interfaces. I can only assume that the ttaenc-win is just an implementation of this (it's only a .exe file so not too sure). If one of the downloads is an implementation of these interfaces then I can use JNI/JNA to hook into them and process the audio that way. If this is the case then it can work, but I just need some guidance.
3. Using vlcj
VLC supports the TTA format so it may be possible to use vlcj to process the audio that way. However, from my understanding on how vlcj works, it would create an instance of VLC every single time I want to use it (and would also require VLC to be installed). If this is true then this solution would be grossly inefficient and wouldn't scale at all even for a small amount of requests (as I assume I would need a new VLC instance for each user).
4. Writing a Pure Java Implementation
Being open source means the algorithm can very well just be natively made. But as I said earlier, I do not understand C/C++ code to make a Java-equivalent implementation and I'm not smart enough to decipher the information about the algorithm on the Tau Projects site (information can be found here and here).
This solution would be by far the most lightweight, versatile, and portable option. If it can be achieved, this would probably be the route I'd like to pursue, but I would need guidance on it.
I am looking forward to build a media player with java, and basically what I found was JMF. But, then again, this API is not upto date and doesn't support latest formats such as MKV. On more research, I stumbled upon
Any simple (and up to date) Java frameworks for embedding movies within a Swing Application?
Got all excited, but then digging some more, left me with this
Adding other video codecs / DVD support to JavaFX 2.2
Now, I am disappointed and in a fix that how all the good media players (VLC, KMPlayer etc) been able to support all video and audio formats. They must be build using a programming language, IMHO !
So, my question would be, in-order to build a complete media player which supports all kind of media files:
Is JAVA incompetent ?
Has one ever build a good media player using JAVA ?
Is it just Java or no modern language can do it ?
Do I have rely and choose C, C++ to do this ?
Well, Java is a programming language that was created to support multiple platforms (like Windows, Macintosh and Linux). It works with a virtual machine: a sandbox. So there are a few constrictions, that are based on this sandbox system: Everything, that you want to use in Java must be compatible with ALL platforms, java is created for. And because playing media is very near to the system and of course the hardware (soundcard, graphics board etc), Java may get problems on getting this compatible to all platforms. Another big problem is: Many codecs, you have to read and play (e.g. OGG-Vorbis) are not open sourced, so you will get problems on finding a good API to work with them. Of course there ARE APIs, but I have no experience with them.
Is JAVA incompetent ?
No, but Java was not created, to do system work. Of course, media playing is not a system work, but is near to the system. And Java does not implement codecs for playing music or videos, so you need custom APIs, as I said before.
Is it just Java or no modern language can do it ?
Well the problem is Java: Try a language, that supports more system- and hardware functionality.
Do I have rely and choose C, C++ to do this ?
In my opinion, this is your best opportunity. You may even use VB or VB.Net or whatever, but I think, you will get bigger problems with Java. Of course, this is just my experience, and other people may say you something different, but I think: Yes, C++ is a better language for a media player.
Hope, that answer helped you, greetings
Cydhra
P.S. Sorry, if my English is not that good, it is not my mother language...
The main problem with including more formats in Java by default is licensing restrictions - many of the popular formats are absolutely encumbered with patents and licenses, and for a company like Oracle to support lots of them as part of the JRE just isn't cost effective (in all likelihood.)
However, as mentioned before JFX8 is now open source, and you can thus compile in extra GStreamer plugins if you so choose. I did this recently with MKV, the process is described here if you want to do it with another format.
Since MKV is an open format, I also see no reason in theory why it can't be included in the default classes, so I created a ticket along with the patch - hopefully it may be included as standard in the not too distant future (absolute earliest 8u40.)
If you just want good media support in Java now however, and don't mind having VLC as a dependency, I'd use VLCJ - I use it in my application and it works a treat.
I'm looking for a library/application that would give me a good starting point for an application that will needed to:
display a (big) rail/street network on a map (geographically limited to central Europe)
rail/street network has its custom graph data structure (no standards we could benefit from)
standard interaction with map: zoom/pan
interaction with network: remove/add nodes and edges. move nodes.
Implementation preferably in Java. Thats's it ;)
Would love to hear your suggestions on this topic!
Thanks very much,
Patrick
There is GeoServer which is a full-featured geospatial server based on the GeoTools library.
Besides, you could check all the other projects hosted by OSGeo.
As for standards, there are quite a few that you could benefit from, developed by OGC.
Give uDig a shoot. Open source and in Java.
Fulfils your criteria of display and interaction (I tried with relatively large vector data, not sure about raster performance though).
I cannot really say how it works with network datasets, but with enough programming skills you could probably hack your way with some custom plugins. Here is a starting point.
Another interesting project worth checking out is Degree which is in OsGeo endorsed projects just like Geoserver.
All java libraries are not present within android e.g. javax.script, java.awt.* etc. It makes it very difficult to use a lot of useful libraries written in java (e.g. libraries for java script evaluation, image processing, etc.).
I am just curious, would anyone have an idea as to why android team has decided to keep these out of android sdk?
This article might provide some basic explanation:
Google’s mobile phone platform, Android, supports a relatively large
subset of the Java Standard Edition 5.0 library. Some things were left
out because they simply didn’t make sense (like printing), and others
because better APIs are available that are specific to Android (like
user interfaces).
I think that other reasons might include the fact that the mobile platform does not have the computational resources that other devices such as laptops and desktops might have (even though this seems to be changing with the introduction of high end mobile phones).
Edit: I think that the concept of 'usefulness' varies, so what yourself find useful might not be so for other people. If you want specific reasons why this specific package was left out, it is of my opinion that you are asking it in the wrong place. With regards to this specific package, the javax.script, you might want to consider taking a look at this previous SO post which proposes an alternative.
I'm developing an application for Android, and I'm thinking that it's functionality might be useful on other (Java-running) platforms (say a regular desktop app -- although I hope that the other platform(s) involved are immaterial to the question at hand).
It's unlikely that the UI will be in any way portable (there's just too much of a difference between a good touch-capable, 4in screen UI, and a mouse-and-keyboard 19in screen UI), so I'm happy enough reimplementing that separately.
However, the core "business logic" (ugh, horrid word) and model (data storage) classes could, in theory, be reused in managing the core app. I've noticed that there aren't a lot of classes I'm writing that don't end up referencing some Android-specific bits (I've got XML resources files, images, and SQLite databases, as examples). Basically everything I've written so far has at least one Android-related import.
My question is twofold:
What tools are available out there to help me use Android-related classes and features (eg resources, databases) on non-Android platforms; and
What classes, features, etc of the Android platform should I completely avoid using (for the sake of simplicity, let's exclude UI-related items) due to non-portability, and what should I use instead to improve portability.
Answers that consist of "hahahaha, you're doomed" are OK, as long as there's some rationale provided.
(P.S. I'd make this community wiki if that was still available; this seems like a perfect CW question to me -- a list of Android portability tips and tools)
Looks like you have already identified the key point by keeping UI and biz logic / model separate.
Also sqlite itself is used not only in Android. But of course the way you interact with it (e.g. SQLDBOpenHelper) is different again.
So I guess having the biz logic and model as separate as possible is the way to go.
You can then put a wrapper around it (e.g. "Data Access Object " pattern which talks to the specific DB).
Still keep in mind that the users experience is best when you are as specific to a platform as possible on the UI side.
Example: there is an App (Push & Ride) on the Android market, which seems to run in a J2ME emulator. So screen input does not use the normal soft (or hard) keyboard of the device, but a simulated phone keyboard with the "abc" "def" combos on the number keys, which makes data entry a bit strange.
This app is for sure very portable (and its functionality is really great), but it just does not feel right.
When you want to go multi-platform, you may perhaps also look at things like Appcelerator or Adobe AIR
I started off doing something similar - I wanted to write an app for Android, Blackberry and J2ME. Conceptually, you can layer your design such that platform-specific components (UI, network access, data storage) are separated from the core business logic.
In practice, I don't find this satisfactory. The issues I faced all related to the core version of Java being different in the different platforms (in Blackberry it is based on J2Se 1.4, while Android used Java 6 as base). This led to annoyances like
Not able to reuse code that uses generics
My preferred classes not being available uniformly (for example, forced to use Vector over List)
I have opened discussions regarding this on SO (here and here), but couldn't reach a conclusion.
The logging layer can be made portable by using the Simple Logging Facade for Java(SLF4J) which is available for java/log4j and for android.
Also,you can try this out
http://wp7mapping.interoperabilitybridges.com/Home/Library?source=Android
Contains documentation and tools to map your android app to windows phone
Also read this,even though it contains instructions specific to android - windows phone interop,im sure they apply to other platforms as well
http://windowsphone.interoperabilitybridges.com/media/49652/wp7_guide_for_android_application_developers.pdf
What I do is create a web service outside of the android app which can be used by the android app as well as other systems (websites, windows apps, iphone apps etc).
A simple REST web service which supports JSON is a good example to fetch data and also insert/update data. JSON is particularly suitable because its so lightweight, and doesn't require alot of bandwidth which is great for slow mobile connections.
This way you can store your models/data storage outside of the android app, and it can be used by other apps very easily.
The database layer can be made more portable by using android jdbc or by using a database abstraction layer/object relational mapper/ActiveRecord implementation.
Has anyone tried make android.database(.sqlite) runnable on a non android system?
If you carefully separate business logic from UI and android perks you would be able to reuse it in desktop environment. Android is quite different from it in intialisation and application lifecycle - abstracting creation and setup of BL is also necessary.
Usefull pattern for this purpose would be dependency injection. There are different frameworks around, and some are more suited for android (like roboguice) or desktop (spring or picocontainer or guice).
Android appliactions are very constrained in memory, and this puts limits on what frameworks you can use there. So you may need to abstract data storage as well ( hibernate comes handy on desktop / server side , but too heavy for mobile device)
I'm inclined to suggest trying out the new native extensions for Adobe Air. It allows you to create a device-specific chunk of native code, and connect it to the Air framework, accessing it as you would other objects in Air. (cf. http://www.adobe.com/devnet/air/articles/extending-air.html). This allows you to keep the Android-only code as is, and then replace that code with iOS, Windows DLL, etc. code as needed.
This doesn't solve the problem of translating Java code to other languages/platforms, of course. Still, some of the logic you are doing natively may very well exist already cross-platform in Air. For example, you can access the camera in Air in all supported OSes without writing any device-specific code.
You will probably need to go beyond the current Air classes, so some examples may help:
Android speech-recognition
iOS batttery
Windows and Mac tutorial
NE tutorial
I am currently trying to implement a database compatibility layer for Spring-Boot-JPA/Android-Room:
"compatibility layer" means my Service-layer-code is pure-non-android-code that can be used in android and in spring-boot. The Service-layer-code uses a common java-repository-interface that is either implemented in android-room or in JPA.
Currently i am stuck here:
Howto use methods of CrudRepository<T, ID> (or SimpleJpaRepository<T, ID>) in a Spring-Data-Repository-Fragment method?