ways to implement desktop application with maps - java

i need to implement a desktop application (possibly with Java Swing) in which i can implement maps (not only Google maps but also other services) in two ways: online and offline. Online means the application calls API services by internet, while offline means that i have maps services saved locally and i can request for them also without an internet connection..
Specifically, my application has to draw a polygon on the map (with the API) and do some computations on the background..
Given this, what services can i use to implement at least one way (online or offline) or both? Thanks so much

Initially, google maps only allowed online use of it's API. Any attempt to save maps for use offline was an offence.
I know that the current google maps app (Android / IOS) supports storing maps offline but I don't think this is open to third parties such as yourself. As with everything google, they want your data so they won't let you use the maps offline since they can't see how it's being used.
I've seen many offline mapping applications based on open street map. These maps are open source and free to use as you please (online / offline).

Related

How to use the Google account from my app's users to make maps api calls?

I am trying to make calls to the google maps api. That's not really a problem in itself. In my Android app, I would like to make api calls to google to get location data for nearby restaurants.
From my own research, I have found that this is not too difficult when using my own api key. However, this would mean that any user of my app will cause me to use my monthly maps api call limit.
Is there a way for users of my app to "sign in with google" and somehow get their own api key so that each user has their own and I don't have to spend my api limit on my app users? There does not seem to be documentation on the matter when I did some research (maybe because it is not possible?). Maybe its just a matter of me using wrong search terms.

How to make an API to interact with my app

How can I make an online server to access API's and handle requests? Then how can I have my android app access this online server to make requests?
I have an android app that I am building for a school project. This app will need to use multiple APIs to gather information to display to the user. However I don't want to allow people to decompile to source code and take my API keys. My plan is to build an online application that will do all of this work on the server side. This way the user only submits a query and the server sends information in response to their request. This will speed things up for the user and keep the keys from being accessed by other individuals.
Steps I think I need to take.
Set up server to access the API's
Make app access online server through HTTP requests
3....
4...
I have a very general concept in my head, but I'm not sure where to begin. If I'm wrong on any part of this question please correct me.
I do plan on moving this to the app store in the future.
edit: Do you know of tutorials that show the building of the API and then loading it to Amazon AWS or another server?
There are many options when building restful services for api consumption. You could start with php, which is the easiest to start with. Here is a nice tutorial that takes you through the initial stage all the way to the end of building login system for android using mysql and php as the server language. It contains the barebone details of setting up the infrastructure and logic. I think from there you manipulate and go further.
https://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
check out java rest easy, it is a nice tool to use to build web API's. You can host it for cheap at red shift or amazon using their pay what you use billing.
The cheapest way for you to host your REST API is to use Amazon's API Gateway. You pay for what you use and pay nothing if it is not being used. API Gateway plays very nicely with Amazon's Lambda service that allows you to run discrete code units - again, you only pay for what you use. Lambda itself plays nicely with Amazon's pay-as-you go NoSQL datastores (SimpleDB and DynamoDB).

java: Android: use case: when to use map view and when to redirect to maps applications?

I have an application and I would be showing driving directions to a particular set of places depending on the place a user chooses. When should you have an API key and display maps and when should you use inbuilt or other maps installed. Whatsapp for instance redirects to other apps.
As per your use case or any general use case this can be done,
Quoting from the Google documentations:
Your application needs an API key to access the Google Maps servers
So, whenever you need to display a map inside your App you will need an API key,this can serve you for displaying markers/places on your App, showing route between two places or calculating the distance between them,
On the other hand, if you want to provide directions you will need to use to Google Maps App and redirect to it.
If you want to display direction then use map app whereas if you want to display location on map then use MapView.

How to use openstack components in my web app

I want to create a web app using OpenStack which will collect data from virtual sensors(programs that will generate dummy data) and then I will provide users operations on that data and i want to bill them accordingly.
I know about the Openstack components like Keystone, Nova, Glance but I don't know how to utilize them in a Web app and how to use it there.
I installed devstack on my system and found out a java library: OpenStack4j to interact with the openstack.
But the problem is that I don't know how to use Openstack components for implementing the different functionalities of my app. e.g: For Logging into my Web App I will use Keystone, For making and storing my virtual sensors I will make programs and store then in X component, For billing I will use Y component to read the amount of data fetched from DB.
Also, is Amazon AWS simpler if I want to do the same thing there?
Your best bet is to read through the Writing Your First OpenStack Application. That guide is in Python as there isn't a version in Java yet. Nonetheless, I think it would help you a lot to read through it and think about how you would do similar things with a Java OpenStack SDK of your choice, like OpenStack4j or jclouds.

I want to use Google Map API for my Desktop application

I want to use google map API for my desktop application. The application will be totally connected to the internet.
While I was searching some research notes about this implementation. I found a ideal site with the configurations, but it has some java files to be downloaded, but when I tried that website its not loading. which is swinglabs.org
http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html
Any other options of doing this api implementation to my desktop application? and one more thing. I tried downloading the google api. even it ask a url.We have to provide a url then only we get a key to download it. And the api should run in that specific url. Otherwise, its not working. How this appears to a desktop application
any ideas welcome.
At the moment it is illegal to use the JXMapViewer with google maps, reason being that this component requires direct access to Google's tile server. According to Google's ToC:
Can I access the Maps and Satellite
images directly?
You may not access
the maps or satellite images through
any mechanism besides the Google Maps
APIs (such as the creation of your own
mapping API or the use of a bulk tile
download script). Your application's
access to the tiles will be blocked if
it accesses them outside of the Google
Maps APIs. See section 5.3 of the
Google Terms of Use for more details.
More information can be found here. You should be able to download the packages from here. They moved the domain and many sites still point to the old domain, hence taking you nowhere.
Currently the only way you can use the JXMapViewer by displaying maps from OpenStreetMap.
You can, however, display static maps on your application. You basically build a URL. This tutorial should give you a basic idea on how to be able to build a URL to be able to request static maps. You then use an HTTP Get request to get the image back.
Last but not least, Google is planning on allowing direct access to their tile servers, but this might take a while.
You can use google maps in desktop applications.
For this you need to embed a browser in your application and then open up html/javascript files which render a map.
Different languages and api provide ways to embed a browser. For example wxwidgets/c++ has a widget called WebView which allows to embed webkit on linux and trident on windows. Similary mfc/c# also allow the same. So checkout how to embed a browser into your application.
The api should also provide a way to execute javascript code in the embedded browser. Then you can modify the google map through the code of the application as and when needed.
I have a desktop application that calls a similar API. They require the API calls to come from one particular domain (and URL). So, I have the desktop app contact my own web server, which calls the third party API and returns the results.

Categories

Resources