I want to build an empty map that I can customize as I like. Now, I know how the whole system works with the tiles and lon/lat coords, but I still dont understand how to contect between my tile's pixels and the lon/lat. I want to have an empty map that shows only my country and that I can edit things the way I like (I work with Android - dont know if it matters).
Write a class which derives from the Overlay class and override the onTap() method. Then you can add your overlay to the your MapView. A GeoPoint object, which represents the position of you tap, is passed to the onTap() method when you tab somewhere on the map.
You also can use onTouchEvent(). Given the screen coordinates of the touch, you can use a Projection (from getProjection() on MapView) to convert that to latitude and longitude.
Here is a sample project.
Related
Is there anyway to create an armorstand that is invisible to players and can float in air? I'm trying to make something like a boomerang that can be thrown but that requires an armorstand to show the boomerang itself. For example: Video. I use spigot-api-1.16.5-R0.1-20210220.225230-24 as my api.
Yes it is possible. You need to spawn in a armor stand, then disable the gravity for it using armorstand.setGravity(false), store it in a array, and then create a loop that runs every tick, and teleports it to the desired location.
Hello I have an android app that has a main menu with two buttons. First one gets you on a Google Maps screen and the other one on a screen that shows a listview with information(name, description, coordinates etc) from saved places on my MySQL database. This example shows exactly how I populate the lisview from my JSON, I've done it the same way. Now what I need is to put markers on my map screen from the coordinates of the places I get from my DB. How could I do this? Could I use the same files(AndroidVersion.java, Response.java, LoadJSONTask.java) I used to populate my listview? (see above example)What should I do to get the coordinates? Can I re-use the files from my other screen or should I start from the beginning? Any help would be appreciated! Thank you!!!
If you have a variable with the coordinates you can just call the map and pass them as an argument throw that screen.
There is a hello animation example, where, apparently, predefined character with predefined animations is used.
But what if I want to create some animation on-the-fly, programmatically? Suppose I want just cube perform some movements and rotations?
I found a class Animation which allows adding a tracks. One of the tracks type is SpatialTrack which has obvious structure: it apparently consists of a series of transformations and rotations over time.
But what to do with such an object, once it was created? How to "apply" or "execute" it on some geometry?
UPDATE
I found another pattern: first create MotionPath, then wrap it into MotionEvent and then add resulting object to the object you want to behave with addControl() method. Probably object will follow the path. Unfortunately, I can't find, how to set the orientation. Despite the fact that MotionEvent class has getRotation() method, which is documented as returning rotation of target object, I can't see any methods to set rotations in MotionPath, which constitues the MotionEvent.
I recommend using Cinematics for what you are attempting to do. All you have to do is create a cinematic object, add the appropriate events to it, and then use objectName.play().
The best part is that you are able to use both your original idea of animation objects as well as through your edited idea of using MotionPaths. You just have to use AnimationEvents and MotionEvents respectively.
You can also implement looping through a simple function that the wikipedia page gives you as well as being able to set direction for the movement.
I'm making a new private android app to take a picture, get your current location in WGS84, and at last send it all in an e-mail to your self.
I have send the mail with the content from the textfields, but I have made a button to get the your current location, but didn't know how to get your location and in same way also convert it to WGS84. I need to get it in this coordinatesystem, because it is used in a special sparetime activity, which uses this coordinatesystem.
Just forget the picture, the coordinate is more important.
Thanks in advance
Greetings Aksel
I'm not 100% sure if I got your question right. But you want to convert the location you get into WGS84 coordinatesm right? I'll guess you get your position via the Android LocationManager using something like: LocationManager.getLastPosition(). What you get is a Location . This location can be formated in different ways.
The questions is what exactly do you want? WGS84 is a reference system and does not say anything about the way coordinates are represented. A common representation are sphereical coordinates (also called Lat/Lon coordinates): Spherical Coordinates.
Another representation would be Cartesian coordinates. Maybe thats what you are looking for. To get cartesian coordinates you should use a 3rd party library.
I'm having problems with adding lines to the map in my android project. Basically, when I want to draw lines from point A to point B android is painting them just fine, but when I want to add another line later (say from point B to point C) android is removing the old line and drawing a new one. I guess it has something to do with collections because I'm using the ItemizedOverlay class to collect all markers and it seems to work, but how to do the same with lines or anything else I would like to draw? How to prevent android from refreshing the map? ItemizedOverlays seems to do the trick, but only with markers/drawables. Can someone please give me some help or at least point me in the right direction with this? I would greatly appreciate it.
I have one class witch extends from Overlay that draws a line between X points in the draw method. i'have a for loop that creates one LineOverlay each time and adds it to mapView.getOverlays() with no problem.
If you want to remove one determined overlay you have to store somewhere in the class when you create them to call later to mapView.getOverlays().remove(LineOverlay item)
Hope i helped you.
See my reply with code samples at How to draw a path on a map using kml file?, it describes how to draw routes (consisting of multiple lines).
Especially look at the Drawing / drawPath() section.