Creating custom map on Android - android

I am creating Map applications for both Desktop(C#) and Android. In some case I need to use custom maps for my applications and it should be able cache in the devices/PCs. I have already found map engine (GMap.Net) for Desktop which is quite good (at least for me).
1). Are there any good engine for Android (preferably open source)?
2). Is there any way that I can use the same engines for both?
3).Any tools to create my own map(from our own bitmap images overlay
onto the openstreetmap,google etc. to get the lat/lon and also for
different zoom level. )

Related

Building a generic interactive map from coordinates on Android and iOS

I am working on an app for Android and iOS that needs to display a generic map of the United States (not a Google map, just state borderlines, no more detail needed or wanted). Each state needs to be tappable/highlight-able and the map needs to be easy to resize across the different screen sizes available to Android/iOS.
I've found that my best bet for rendering the map on Android is to use Canvas and on iOS is to use CoreGraphics and CoreAnimations.
I've found state borderline coordinate data on a site called Global Administrative Areas . The sites offer files that can be edited with Gqis.
This brings me to my questions:
Can you use Gqis to produce code that is usable by Canvas on Android and CoreGraphics on iOS?
Does anyone have a better idea on how to approach rendering the interactive generic map?
(edit) Am I on the right track with Canvas and CoreGraphics?
After doing more research, I've found that Gqis, or Qgis as it's called now, does not provide an SDK to interact with geopackage data. I've found two solutions:
a paid solution - use ArcGIS's Spatial Database, Android SDK, and iOS SDK to handle the data from the geopackage.
a free solution - use Qgis to create a Spatial Database that can then be used with the free GeoPackage SDKs provided by the National Geospatial-Intelligence Agency (Android SDK) (iOS SDK) to handle the data from the geopackage.
Lastly, Canvas and CoreGraphics seem to be a good way to handle the actual rendering of the map.

Mapbox GL using external maps

I want to use Mapbox GL in my Android application. This service is going to be released soon and I have a tricky question about using the renderer.
I like the renderer itself, but I really want to use my own maps data in the application (not the data, offered by Mapbox and which is paid). For instance, I want to parse OpenStreetMaps data on my own, customise it somehow and then put inside of a renderer to show it in my application.
And now the question: is it possible to use my own maps data while using Mapbox GL? Or it can be only used with Mapbox data?
Thank you in advance for any help. Maybe you know any other well-done solutions for this problem? The thing is, that I want to have vector tiles, not the raster ones. And this project is planned to be developed for iOS later..
You can use MapBox open-source SDK with your own tiles. The Mapbox Native renderer for Android, iOS or Node.JS can be used directly with tiles hosted outside of MapBox.com platform.
See the sample mobile app "OSM2VectorTiles" loading the vector tiles from a custom server or locally from a embedded MBTiles.
Android: https://play.google.com/store/apps/details?id=com.klokantech.osm2vectortiles
iOS: https://itunes.apple.com/us/app/osm2vectortiles/id1089255502
The trick is to point the style attribute in the API to your own JSON style file - which requests the vector tiles from your own server. An example:
See https://gist.github.com/klokan/3eee87899644f5d82b3946bf0cd1e176
See project http://www.openmaptiles.org/, where you can download ready to use vector tiles made from OpenStreetMap - or check the documentation of this project on how to generate your own customised vector tiles.
Hosting of the vector tiles itself is described at https://openmaptiles.org/docs/ or https://gis.stackexchange.com/questions/125037/self-hosting-mapbox-vector-tiles
You may need to host somewhere the assets (font glyphs + sprites) and the JSON style itself - or embed these directly into your mobile app.
If you want to rasterize the vector tiles with the same JSON style on a server - for a web-application compatible with old web clients (Leaflet, ...) or for static maps or print output with the same look&feel as you mobile app maps, you can check https://github.com/klokantech/tileserver-gl
You can use your own tiles. I tried 2 things. Generating my own Mapzen vector tiles (they use same format as Mapbox) And you can also use them for free. Here is their layer descriptions. This is quite work intensive. You need to have postgresql and load whole OSM PBF export into the database, then you run python server which requests data from this database and renders vector tiles. I think it is meant to render all the tiles in queue since it took couple of seconds per page to render visible tiles. Most of the time was spend in python after DB server was queried.
It's advantage is that you get nice tiles back. It has basically everything you need, but is much harder to customize. For example if you want to add specific style to cycle ways. You need to go deep into the code and change couple of query templates and a lot of other things.
Then I tried Tilemaker. This is just C++ program which reads OSM PBF dumps and lua config script (where you specify what tags to send into tile) and spits out mapbox tiles. It's advantage is that it is much easier to set up and customize and that all tiles are rendered at once. But it is harder to create nice tiles. (AKA load all the different highway tags are roads just of different kind. It is up to you to specify that but this already works in previously mentioned Mapzen and also Mapbox).
For example kind in Mapzen roads layer In mapzen this is already taken care of but in tilemaker it is up to you to write all the conditionals that get road type from different OSM tags into a layer. And it gets more complicated in landuse tags since kind is a:
combination of the landuse, leisure, natural, highway, aeroway, and amenity OSM tags, or urban area and park or protected land for Natural Earth areas.
Of course you can have completely different tags but it is nice to have one which tells you what landuse you are looking at.
You ned to know that Mapbox, mapzen your custom mapbox tiles all use same format, but each will have different tags. So the style you create for one probably won't work for the other.
For creating styles you can use Mapbox Studio (but is probably useless since it is in public beta currently and I'm not sure if you can specify own tiles there).
I used Mapbox codeflow, which is basically nodejs server with gulp script that reloads site with a map when style file changes. It also supports writing styles in toml, JSON5 and yml in addition to JSON. It also shows errors kinda nicely. (only line numbers are missing) Currently it support version 7 of styles but 8 is currently out. For getting line numbers of errors I used Mapbox GL style spec which can also update style to the new version.
You can also try Glug which is a different style language which compiles to Mapbox GL style. It is a little more compact.
For using tiles you can also create mbtiles with mb-util and use them.
If you have a running Tileserver GL, it is as easy as changing the following line from an example app from mapbox:
mapboxMap.setStyle(Style.MAPBOX_STREETS) {
// Map is set up and the style has loaded. Now you can add data or make other map adjustments.
}
to
mapboxMap.setStyle(Style.Builder().fromUri("https://maps.somedomain.com/styles/awesome_style/style.json")) {}

Offline Map Application Development Android

I have a project , android application with offline Map. user should download map once, or It should come with the app and then without internet be able to make marks and so on.
Can you give me Idea, which maps should I use, and little example . Thanks
You can use osmdroid
osmdroid is a (almost) full/free replacement for Android's MapView class. It also includes a modular tile provider system with support for numerous online and offline tile sources and overlay support with built-in overlays for plotting icons, tracking location, and drawing shapes.
Also see osmbonuspack

Any way to change the Map used by Google Maps API in Android?

I'm trying to make an Android application that will display a map of a local area only (a big building and surroundings), and I want to know if it's possible to take the Google Maps API and modify the map it's using to be the map I made myself.
If this cannot be done, I will ask my question in a broader sense: How can I create an interactive map app for Android that will use an image made by myself?
I want to know if it's possible to take the Google Maps API and modify the map it's using to be the map I made myself.
Not through the Google Maps add-on for Android.
How can I create an interactive map app for Android that will use an image made by myself?
The same way you implement 2D games: draw it yourself, probably using the Canvas 2D API.
It is possible that there is a third-party library for handling this. For example, you might peek at the OSMDroid code, as that is open source and handles map tiles coming from OpenStreetMap. In theory, one should be able to create a general purpose "map" widget with pluggable tile sources, where the widget handles pan, zoom, etc.
I note that you have the app-inventor tag on this question -- App Inventor is going to be incapable of doing this any time soon.

Using pre-defined overlays in Google map

well i was able to find loads of information on how to create my own custom overlays onto the map, but none on how can i use the ones that google already has put on.
I basically want to use all the overlays of one type (say the Hotel overlay icons) and get their geoPoints and then use them in any way i want...right now i have to manually get the geoPoint of every such hotel overlay and then use them, which is pretty painful considering google has already marked them out...but i have no idea how can i use them..
Any idea how can i do this?
Those are not available to Android SDK developers -- they are part of the proprietary Google Maps application. The only pre-built overlay available to SDK developers is MyLocationOverlay.

Categories

Resources