I need help to integrate OpenStreetMap with Android - android

Good Morning,
Part of my question uses the word OpenStreetMap instead of osmdroid because part of what I need is a map visual reference/preference for users of my app but I need a grid reference of a map not just lat/long. I believe it was a link from SO that lead me to this: http://dhost.info/usngweb/USNG_OL.html. This is very much what I had in mind for the visual side of my app. The grid is right there. In other words part of what I need has already been created.
The author of the grid in above link uses JavaScript to create the grid of the Military Grid Reference System, which I am familiar with from IBM's tutorial - and zip j-coordconvert.
My question:
1.) In the above link there are radio buttons to switch from the type of map and also the meter zoom. Would it be good advice to use an Action Bar to allow user's to adjust these preference's? Has this also already been done?
2.) If the advice is to use an Action Bar - once user has selected a preference he/she will go to another choice with the original selection seldom changing - would I build that Action Bar up so that I have http interface with the above OpenStreetMap? If your advice was not to re-invent the wheel and use http to reference the already created grid, I would want to grab user's preference is there a code snippet to get the selected preference from http into Sqllite?
This last question my end up being the biggest part of this set off questions - getting the zoom level from http into Sqllite.
Of note:
-Will, at first only be needing one rather big city in U.S. so can cut tiles needed down
-Need rather quick solution on map side as other parts of app will take longer, so can build up my own map grid over time
-Could cut out the selecting of different map types but not grid zoom
-Using latest version of Android Studio
-Familiar with retrofit
-Referencing Busy Coder's Guide 6.6
-Would prefer to stay in Java rather than JavaScript
-Will be targeting newer phones/Android version above 3
I know this is a lot to ask but I am rather new to Android and my head is swimming with the amount of information out there (a good thing).
Thanks,
Terry

There is no "preference from map source to sqlite".
If you need to provide a TOC (that selector on top right) you need to build up your UI and do the logic for enabling/changing layers (what you see on the map).
You can use Google Maps API (v2) to have the map (just set the map type to NONE and add openstreetmap as a TileProvider, there's a lot of examples, just google it).
For the grid, a brief look at the page source code seems that the grid is created by javascript and is not a webservice that provides tiles (isn't it?). If so you have to create your logic that creates the tiles given the coordinates, this is a bit long to do, but you could look at some code online, for example Google I/O app has something with SVG files:
https://github.com/google/iosched/blob/master/android%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fsamples%2Fapps%2Fiosched%2Fui%2FSVGTileProvider.java
About preferences on enabled layers you can use SharedPreferences.

Related

Creating an interactive seating map in Android Studio using either a custom layout or webview

So I'm on my first android project and I'm implementing a native app. One of the components is to book a seat on a seating map.
General specifications:
Handle venues that have different seating layouts and amount of seats, over 200
The seats can have different sizes and shapes, i.e. large round VIP seats and standard square seats. Imagine small round stadium with a lot of custom seating and different orientation, with a stage in the middle. (I have an image but can't post because I don't have enough reputation)
What I have tried so far:
Created custom seat class with size, seat number, orientation and seat type
Used a StaggeredGridLayout and a view-adapter to load each of these objects dynamically from a DB onto this layout.
My concerns: No matter how much I was worked on it, it never came out the way I wanted. Basically, I think this is better for grid maps with one sized objects like bus seats placed in the distance between each other and doesn't have a huge irrelevant object in the middle like a stage.
I was thinking about changing directions completely after doing some research: Using webview? Each venue would be a web page, that would be linked from the venue object from the DB. Then in that web page, I could make this sort of venue a lot easier because I could just place out this layout manually and style with different div elements or make an interactive javascript map, attach a button and make a call using Jquery/Javascript to my native android app.
What are your opinions, is this a feasible solution?
To be honest, an interactive seat map development was the most challenging task I have ever had in my development life. But some how I have done it for an asymmetric seat plan.
This type of work can be achieved in following two ways.
1. Using GPU rendering - Much easier process as almost every device has GPU by default. It detects the interaction point and check it's RGB value to detect the right path has been interacted and return this through client interface (with some drawbacks). e.g: Webview interacting Js interface in android and others.
2. Using CPU based drawing - Draw each and every path on the canvas and repeatedly it need to check the touched/interacted point is inside the paths or not. It will use more the CPU if paths are more complex to render/draw on the canvas for every single interaction. (hug CPU usage and some other constraints)
I am tired of searching some library in android which is very useful like Macaw in iOS development. This library handles the interactive path inside a svg file and help to interact with the client side.
Anyways for me, neither of the two options are not feasible though. I will go with importing/downloading .svg file to your android application and make it interaction using JavascriptInterface in your app. Unfortunately, this is less worse solution that I have found out so far.
UPDATE:
Here is my approach to make it workable. See my medium blog post. Hope it will help you.

Here API customization tools

I'm using Here Android SDK and trying to customize my map. I follow the example at enter link description here. But for some CustomizableVariables I can't assign color because I don't understand what exactly such parameter means. For example at mapbox has mapbox studio - it really simplifies the process of custom scheme creation. Is there anything like that for here maps?
It would be very useful at least be able to find specific areas on the real map, to decide what color or size to assign.
Maybe there is some way I can move the map to the area with specific CustomizableVariables? Or is there any docs, explaining what all such parameters means?
There is no high level user interface to mange map customization for Here Android SDK. The customization is based on using the available CustomizableVariables. For many of them, the naming is self explanatory. Otherwise it is a hit and trial approach to see how the variables affect the visuals of the map.

OSMdroid and MBTiles: get area information

I am planning to build sort of a geography quiz app where you have to touch inside the borders of the searched country. So, I have to display a map (I want it to be offline) and be able to test the user click against the map in some way.
I've been searching a while now and found good OSM material from Natural Earth Data and TileMill for converting it to a MBTiles-file (sqlite-database containing all the png's and some meta-data too (using UTFGrid)).
On the Android-side, I would like to use OSMdroid for displaying the maps, mainly because it's open-source and highly maintained.
I've found some guides on how to use the MBTiles-database inside osmdroid but is there also an easy way to access the metadata or check otherwise if the user touched inside the right country area? I would like to avoid some sort of "boundary boxes"...
Any help is highly appreciated!
I'm pretty sure that bounding box calculation is best option.
Can you access metadata from the offline tile source? Yes, kind of. You can get a list of unique tile sources in the archive but that's it. There's an open issue regarding getting the bounds of a given offline archive. You can follow it here (or contribute)
https://github.com/osmdroid/osmdroid/issues/174
It's slightly complex because offline tiles are going to have a bounds per layer/source and per zoom level. There's also no guarantee that that bounds of that given zoom/layer is going to be contiguous. I.E. one zoom level can have both the US and western Europe in it.

MapBox Find terrain class by coordinates in Android

I spent several hours looking for simple solution and still haven't found one.
MapBox style editor uses this simple feature. That you can hover and click over map, and it shows small popup stating all terrain classes you enabled in your map.
Question, how to do it in Android version of MapBox given I have installed my style. Now I want click on any place in the map and get the same popup stating, for example, that this is building, woods, background here. Or other place would satte, that this is major road.
This IS doable as MapBox studio itself shows. i can't believe it uses some API not available for anyone, as this is one API no map provider gives, while still able correctly draw terrain. What so complex to add this API?
And NO I am not interested in address. I am interested exactly on terrain, for simple task - distinguiosh water from non-water, road from non-road, building, from non-building, don't care where it is by address, so reverse geolocation does not work. Or simpler - I need SIMPLER geolocation, than address.
Your questions kind of confusing but I'll try and help. If I'm reading correctly, you are trying to create an Android app that uses an API similar to Mapbox Studio that allows the user to select/distinguish the difference between objects on the map such as buildings, water, forest, etc.
If this is the case, then first you must understand that Mapbox Studio is using OpenStreetMap data to distinguish between objects. These objects are stored in a database with tags. It's tough to explain so i'll just leave a brief reading wiki page that might help.
To my knowledge, there isn't any API's specific to Android that will give you the kind of information you're looking for. However, if I was in your dilemma I'd take a look at the Overpass API as it's a complex query tool that allows you to send coordinates to it and it will return all the tags (such as building or water) at that location within a JSON object. From there you can parse and use the data in your app. It is very powerful so I suggest reading up on how to use it and test using a website called Overpass Turbo, that's if you decide to use it.
Nevertheless, I hope this helps and I understood your question correctly.

Creating an application using the google maps api that has a custom layer over top

So, my question is somewhat of an odd request I think. I was an intermediate java programmer making android apps a couple years ago, but I quit for other things. Now I'm back with a new and (I think) somewhat bold idea and I need help.
I'm wanting to know if it is possible to utilize the google maps api to act as a base for another map that I layer over the top. Think of it as I'm changing the way the map looks and that's about it.
I'm wanting to create a mobile app that has a map with a new/different look than what the base and satellite views have for a set small area of the city. Think of it as something like taking any old image and slapping it over the top of the google map and still being able to navigate with it (obviously if it was a random picture you wouldn't be able to see where it was taking you, but in theory you could essentially create a new map).
Is this possible in both java and obj c?
As far ask I know, you can't add your own tile layer to the Google Maps API for Android. However, you can use osmdroid and add your own tiles. You could also use mapsforge for Android. It comes with it's own tool for creating custom map tiles.

Categories

Resources