I want to make an Android App, with a real map and a overlay for the map, where sprites are drawn (can be dots or small images).
This is a rather hard question, so I have made a sketch of a map of a small city, where only roads and streets can be seen. That might look something like this on the device:
Imagine the red dots to be bots, and they want to get to the yellow dot, assuming they know the position.
What Android Map API should I use to be able to:
Draw custom sprites on a given location on the map (geo-coordinates rather than screen coordinates).
Generate valid paths from the streets and roads on the map, which the dots can move on (black lines).
Use pathfinding to calculate the shortest routes, e.g. from red dot to yellow dot.
Must be able to draw more than 10 sprites on the map.
(the map doesn't have to support 3d views or street views. Plain old top-down view is just fine)
If no map API exists that does not meet these requirements, what are some other solutions?
I'm really excited about this project, but I'm having a lot of trouble getting started with it, so any help or guidance will be much appreciated.
EDIT:
It seems that there is no answer to my question. I will leave this open and report back with my own solution.
Google Maps Android API v2 and Marker class.
All valid paths? You probably should not need it if you use Android API v2 with real map drawn for you, but you can also try to use Google Directions API.
Google Directions API.
No API exist that can handle more than 10 objects. You probably need something from NASA.
Have fun coding.
Related
I'm developing an Android application (in Java/Android Studio) which receives Latitude/Longitude coordinates from a network source, which it has to plot on the screen. The appearance should be much like one of those old 'green-on-black radar screens'.
Constraints/Requirements:
The application doesn't have connection to the internet. (never)
I need to draw points, (custom) markers, lines, and polygons, all based on latitude/longitude information.
The background should be plain black. i.e. no map tiles or anything.
Does anyone know of a library which can help me achieve this?
Other options I'm considering:
Manual direct conversion to screen X/Y coordinates. This seems problematic (?) as you get closer to the poles.
Converting all points to polar coordinates (bearing/distance) from a center position. And then convert these polar coordinates to screen X/Y coordinates. Should work for the radar-style application, but seems cumbersome when there's a good library available.
I'm really interested in what you guys think and if you have suggestions on how to address this.
Thanks a million!
Kind regards,
Joost
I am making an application where one person can watch all the other users of the app driving on the streets. I am using google maps and I am animating markers on the map, as the location of the users is changed in real time using socket.io.
The problem is that most of the phones have not so accurate gps, and the pins are moved all across the map, not only on the streets, the sometimes jump on the grass, water, they are rotated in the wrong direction, etc... Is it somehow possible to move the markers on the street only?
I guess this can be done using google's direction API. You can request google direction api for the point you have to another point on the road. Google's response first point can be taken as on the nearest road point. I had look on the similar solutions people done on the web.
Have a look on this.
I am working on a mobile Android map of my university campus using Google's Android map API. I have currently used Polygons to color in each building according to their faculty. I have also placed GroundOverlays to show where each food place/ATM is. However, the Polygon's seem to lay on top of the Groundoverlays, but I want the opposite to happen. Is this possible?
you must use Zindex to change the layering of items:
put polygons without setting zIndex (or set a low value), then put ground overlay zIndex to hundreds (or thousands) and you are done!
https://developer.android.com/reference/com/google/android/gms/maps/model/GroundOverlay.html#setZIndex(float)
I've created a map I want to classify my map into Let's say hexagon grids like cellular networks so I can be able to color each hexagon independently, the only work around I found was to manually draw circles using the overlay class and the ondraw method, but in order to manually do so I'll have to create like thousands of circles. I need a hexagrid on the whole map so when I need to color a hexagon I just find it by Let's say it's name or number. does Android support such feature?
No, Android does not have a built-in hexagon overlay for Google Maps. It is conceivable that you could find a third-party component for this, but more likely you will need to implement it yourself.
I'm trying to develop a 2D game to android using opengl.
I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
Can anybody help me?
I don't have any api examples but I did games design at college so I'll give my two bits.
The method you use will depend on your map style, size, functionality and format.
For example if you are looking for a very static non changing map, use a simple picture image. You can use the API frame for a picture view, enabling you to zoom in and out as you do in the gallery and to scroll on zoomed images, or in this case, zoom locations on your map.
Alternatively, if your map is based off a tiling system, a good example of this is the original Pokémon and Legend of Zelda games from the old game boy, then each area stores a tile 'thumbnail' for itself as a bitmap. These are then put into their appropriate locations on a grid depending on what areas are discovered.
This is the probably the most flexible way to build your map as you are not relying on a set bitmap for the entirety your map meaning it can change its look efficiently; you can build it as desired to show areas of choice (useful for if the map only reveals places the gamer has covered) and it also means you can do tile based overlay:
ie - if a certain area should contain treasure, theres a treasure icon overlayed on that tiles x,y position on the map grid.
I used the tiling option in my game projects from college and it made everything else map related easier. It also made the map side of things smaller storage wise.
The simplest approach would be to just call glTranslatef(-scrollX,-scrollY,0) followed by glScalef(zoom,zoom,zoom) before you render your map.