SkMaps Android - How to get lat/lng used to draw roads - android

I would like to use the lat/lng data used to draw roads to make my own custom routes and draw lines beside the streets (like to indicate sidewalks). Is there any functionality like getPolyline("SanFran Road") that will give me data points that I can use to draw my custom routes/lines?

You have the pointToCoordinate that returns the long/lat position relative to the screen position.
See more in the SKMapSurfaceView class.

Related

Highlight all the worlds in Android Google Maps

I'm developing an app in which the user can select points on a Google Maps and create areas based on point-radius and display them on the map with a semi-transparent circle of a specific color. The user is also able to insert "all world" areas. I need to display this "all-world" area on the map, is it possible to add a semi-transparent polygon that cover all the map? Or, is there a better solution to highlight all the map?
Check the documentation of Polygons under the Shapes in Google Maps Android API to cover the map.
Polygon objects are similar to Polyline objects in that they consist of a series of coordinates in an ordered sequence. However, instead of being open-ended, polygons are designed to define regions within a closed loop with the interior filled in.
To create Polygon, first create a PolygonOptions object and add some points to it. These points will form the outline of the polygon. You then add the polygon to the map by calling GoogleMap.addPolygon(PolygonOptions) which will return a Polygon object.
To alter the shape of this polygon, just call the Polygon.setPoints() and provide a new list of points for the outline of the polygon.
Now, for customizing the appearance of the polygon, just check this link. And for the semi-transparent polygon that you want, you can check these tutorial and SO question on how to achieve that.

Android : How can I draw rout on GoogleMap with heading angle?

I have a program that draw a rout of user in the google map. I want to draw another rout with the data that I got from other sensors of smart phone.
how can I do that? I think I should draw a line (for each step) from specific longlot with a defined length with a angle that I got from sensors(for example magnet).
but I don't know how I can determine LongLot of the end of the line?
For showing any route on the map you need to have coordinate data in form of Latitude and Longitude. Using sensor (magnetometer) the data that you will get are the bearings in between 0 and 360 which you cannot use in map to locate a point or even a polyline.
The best thing you can do with that set of data is to create a pointer on the map that would rotate as the user holding the device changes his directions.
Please refer to this example to know about the code implementation.

Drawing on the MapFragment, while keeping some elements visible

I'm developing an application that has the following goal:
Using the google maps android API 2 I get my current position, and as I start walking the application starts drawing the route I take
The twist is that the map is a "blind" map. Meaning the map is hidden, only the Marker of my current position and a dotted line of my route is shown.
Keep in mind I'm a novice developing to Android, so please be specific. (Thank you)
I managed to create the map, get my current position and zoom in to it (Had no sens to see the whole planet while i want only my current position). And it's pretty accurate so far.
The thing is I don't know what should I do from this point on.
Basicly I need a white View between the Marker and the real map. Also as I advance that View should always be on, over the MapFragment/MapView. Also I wish to keep the zoom and drag functionality's of the MapFragment.
How can I achieve this?
At this point I'm opened to any solutions.
(Been browsing for a few days now the developers site, I have seen that with the ViewOverlay class I can put messages over the map, but I'm not sure what would the correct aproach be in my case...)
To hide the whole map behind the white view I would use Polygon class Polygon Even if you specify Polygon to cover the whole map Markers will be still displayed in front of it and as so user's current position marker will be visible. You also will be able to zoom and drag.
To draw line on map use Polyline class Polyline It will draw users path as a polyline. If you want to stick with dotted line you can use Circle objects to create it. Circle

How to draw overlay on map in android?

I am able to draw a point at particular GEO POINT on map.Now i want to draw overlay on map like this
How can i do it ?
I have kmz file containing all info about overlay like list of geo points.
Can any body guide me ?
I used this tutorial. Part two is what you need. http://mobile.tutsplus.com/tutorials/android/android-sdk-build-a-mall-finder-app-mapview-location/

Android custom GPS map application

I want to build an app that uses GPS data and a building map I provide to show the user where in the building on the map they are. This will be done in a specific building that i already know gets GPS and cell service.
At first I thought the easiest way to do this was to see if I could use Google maps to plot the users location and then just "overlay" my custom building map on top of the Google map so that I wouldnt have to deal with any of the gps information or the complexities of the mapping I would just have to scale my "overlay" to fit properly on top of the Google map so that the user was shown in the correct room in a building. I'm wondering if anyone can provide me any information on how to do this or if there is an easier way to accomplish my map. Any information at all is helpful!
You want...
Google Map View
...and more specifically you will probably want to read the subsection appropriately titled: "Part 2: Adding Overlay Items"
EDIT: Whoops! Nevermind! I misread your question... that is only if you want to overlay an item on the map. Sorry...
There is no possibility to use closer zoom level than that you can see on standard GMap i.e. in browser. Other problem is that google uses GeoPoint class based on cardinal microdegrees to draw overlays, and it's accuracy is to low.
You can look on jGarminImg - it's java library - unfortunately written for using with swing, but it should be relatively easy to make it work with android. On the other hand - you have to make your own map.
You can use standard overlays, or you can make your map in kml format and use this example to display it.
You may be able to achieve this with a custom view that displays your building plan and knows the precise co-ordinates of each corner of the building.
When you receive your location updates you can add a marker to your custom view by translating the real world position into a position in the image using something along the lines of:
pseudocode:
markerX = realWorldX - mapStartX;
markerY = realWorldY - mapStartY;
if( isOnMap( markerX, markerY ) )
{
drawMarker( markerX, markerY );
}
Yes you can overlay bitmap images on top of the Google MapView.
All you have to do is subclass the Overlay class, override the draw method, and draw on the canvas. You have to provide a rectangle of GeoPoints (probably the top left and the bottom right corners) to anchor the building bitmap on top of the MapView. You use mapView.getProjection() to translate the latitude and longitude into xy coordinates on the canvas.
I assume drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) will be useful here. Bear in mind that src and paint can be null. If the GeoPoints you used are accurate, the bitmap will adjust automatically to pans and zooms, although it might get pixelated if the user zooms in too much.
edit: I am not so confident that Google Maps will have your building stays at the exact same GeoPoints in different zoom levels, so you might have to adjust those values for different zoom levels
If you need only the map of the building, it should not be too difficult to plot the location on an image without using Google Maps, provided that you can determine your location as coordinates inside the building.
You need to know two coordinates: north-west and south-east corners of the building map you are using. When you get GPS location updates, the correct location on the map image can be easily calculated based on these corner coordinates.
I would do it like this,
Place a marker on the google map to indicate the position of the building
Drilling down on the building would load your building map as a custom view. Plot the user location on the custom view
I think trying to overlay your building map on a google map while possible will be more complex to code than doing it via a custom view.
Also overlaying the lowest zoom level with your building map is not going to give you enough resolution unless you have a thumping big building. Whole blocks are pretty small
One issue you have probably already considered is the device will revert to cell tower and wifi for it's location when inside the building giving you a less accurate location fix.

Categories

Resources