how to place geopoints on the image as map in android - android

hi this raju iam new to android. i created a small project in that project i displayed a image as map with custom view.
I have latitude and longitude point then how to show geopoints on image by using my latitude and longitude points please anyone help me.
if any one knows please provide some samples.

Hope this will help you GoogleMap in Android

There you go.
String getMapURL = "http://maps.googleapis.com/maps/api/staticmap?zoom=18&size=560x240" +
"&markers=size:mid|color:red|"
+ yourLatitude
+ ","
+ yourLongitude
+ "&sensor=false";
URL imgValue = new URL(getMapURL);
Bitmap userIcon = BitmapFactory.decodeStream(imgValue.openConnection().getInputStream());
ImageView imgMapInImage = (ImageView) findViewById(R.id.imgMapInImage);
imgMapInImage.setImageBitmap(userIcon);
Customize the rest of the parameters such as the width and height attributes in the getMapURL. My example uses the dimensions of 560*240. Use your dimensions. Also change the zoom, the pin size and colors to your liking.
Hope this helps.
EDIT: this example uses the Google Maps Static API. For more customization options, refer to this URL here: https://developers.google.com/maps/documentation/staticmaps/

Related

How to Zoom Only Image in Android Webview Onclick on Image?

In my app only page gets zoom.
How to Zoom any images in android webview on tapping image.
Please help me with an example source code.
BINGO!!! I found a temporary solution to this problem.
Injected custom CSS to android Webview and I was able to scale image.
contentText = new StringBuilder().append(AppConstant.CSS_PROPERTIES).append(contentText).toString();
webEngine.loadHtml(contentText);
And I customized CSS properties in java class file. When I tap on the image it gets scaled by 150%
public static final String CSS_PROPERTIES = "<style>" +
"img:hover{transform: scale(1.5) rotate(270deg); transition:0.5s ease;margin-left:auto;margin-right:auto;}"
+ "</style>" ;
Any Suggestion please comment.

[Android][Mapbox] How to add others tile source to Mapbox map?

I'm looking for a solution to add other tile source to Mapbox map. For example, I have an tile source url like this https://tile.openstreetmap.org/{z}/{x}/{y}.png and I want to add this tile above original Mapbox Layer. I intend to use RasterLayer, but I don't know which url format should be inputed to this Layer, Mapbox document isn't clear.
Anyone could help me a solution for this issue?
Thanks!!
You should use the RasterSource with a TileSet :
RasterSource source = new RasterSource("source-id", new TileSet("2.1.0", baseUrl + "/{z}/{x}/{y}.png"));
map.addSource(source);
Another solution is to upload your tilesets with your mapbox studio account.
Drag and drop a MBTiles, KML, GPX, GeoJSON, Shapefile (zipped), or CSV file here to convert it into vector tiles. To create raster tiles, drag and drop a GeoTIFF file.

Android - Facebook Sharing Uncertainty (Text)

The code below works to share an image. I'm having problems adding text to it without using a FB graph (which I dont want to do at this point). This code shares an image straight to Facebook but:
1) how do I also share text? I know how to do one or the other but cant seem to figure out both.
2) is it possible to have Facebookj scale the image?
Thank you for your help.
int imageToShare = getResources().getIdentifier(myCard.getImageId(),"drawable","com.gjnave.carddisplayertemplate");
Uri cardImageUri = Uri.parse("android.resource://com.gjnave.carddisplayertemplate/" + imageToShare);
bmpImage = MediaStore.Images.Media.getBitmap(this.getContentResolver(), cardImageUri);
performPublish(PendingAction.POST_PHOTO, false);

Creating Google Location URL by using latitude & longitude information

I have a code where I'm retrieving latitude and longitude information. I'm interested to show that information on map. I would like to create a link for Google map with retrieved "longitude" and "latitude" information. I am using Linkify for this as follows:
**** Java Code**:
String text = "maps.google.com/?q=latitude,longitude";
TextView label = (TextView)findViewById(R.id.textView);
label.setText(text);
Pattern pattern = Pattern.compile("maps.google.com");
Linkify.addLinks(label, pattern, "http://");
But this code is not working. Can someone help me with code?
I am getting something like following. My longitude and latitude are not getting linked with rest of the url.
you may use below code for displaying map
String url = "geo:" + sLatitude + "," + sLongitude +"?z=22&q="+sLatitude + "," + sLongitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
above code shows map using google map application installed in your phone, it also mark the location with zoom level of 22. No google map api key required
Hope this will help...
You may also use the android:autoLink attribute of the TextView to convert the string into links. It controls whether links such as urls and email addresses are automatically found and converted to clickable links.
For example, you may add it in your layout (.xml) file.
<TextView
android:id="#+id/google_map_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web" />
It will automatically convert the text into links for you. Hope it helps you :)

Show a geo location using webview

I want to show a particular geo location on google maps. I can't use mapview / mapactivity.
Also I can't use action view intent
Can I use webview for this?
Open a url like this should work:
webView.loadUrl("http://maps.google.com/maps?q=47.404376,8.601478");
Replace 47.404376,8.601478 with your lat / long. Works in the browser, I guess on a mobile device it will open a mobile version of Google Maps.
Check out google Static Map API
https://developers.google.com/maps/documentation/staticmaps/?hl=nl
You have to construct an url that displays a static image of a map (possible markers) of your location.
you can then download it and display it in an imageview.
String latitude= "45.838211";
String longitude = "9.334661";
String url = "http://maps.google.com/maps/api/staticmap?center=" + latitude + "," + longitude+ "&zoom=10&size=400x400&sensor=false"

Categories

Resources