I am using android 2.9 or something for my project.
Now the project is an image button on the main activity and when a user clicks on it, the user will see a google static map.
Problem is, each tutorial I have seen until now uses GOOGLE MAP API in the project, which I think is not possible for me, as am using android 2.9, not Google APIs,
and I don't know how to add as it just gives option for one only.
So is it possible to show just a static map without using google maps in ones application?
thanks a lot.
yes thats quite possible but in that case you will only get a static image without zoom in/out options... u can also add markers on it...
just send a Http request with/without your markers to http://code.google.com/apis/maps/documentation/staticmaps/
save the reply in a file and that would be the map.
I'm not sure I understand your question completely - but Google Static Maps API is simply a web-service.
Ie - you hit a URL, where the parameters describe what map you are after and you are returned (by HTTP) an image of the map rendered for use in your application.
Check out the Static Maps documentation. There are plenty of examples. You'll see you don't need to use any API in your project at all, you just need to construct a URL that describes the map you would like and catch the response!
Edit:
Here is a simple example of a URL your app could generate:
http://maps.google.com/maps/api/staticmap?center=London,%20England&zoom=14&size=512x512&maptype=roadmap&sensor=false
URL parameters pass in values to the web service to describe the map you would like to generate.
The URL above generates a map centered on London, England. The zoom level is set to 14 (higher numbers = a closer zoom), and the map is 512x512 pixels. If you look in the static Maps API documentation, you'll see there are many many other options you can pass into the service place markers and annotations on the map.
I hope this helps!
N
Related
Google Places API - How to get the mini map with two photos like so?
But, a part of the image was missing. Can anyone guide me?
I only can get the bitmap image left side part, but it missing the right side part of the photo with Google text.
The guide: https://developers.google.com/places/android-api/photos
Here are two ways you can put a map next to the photo:
Use a MapView object from the Android Maps API SDK.
Use the Google Static Maps API to request a map bitmap via HTTP.
What I can suggest is that you try the Place Photo Requests HTTP request:
https://maps.googleapis.com/maps/api/place/photo?parameters
sample:
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRtAAAATLZNl354RwP_9UKbQ_5Psy40texXePv4oAlgP4qNEkdIrkyse7rPXYGd9D_Uj1rVsQdWT4oRz4QrYAJNpFX7rzqqMlZw2h2E2y5IKMUZ7ouD_SlcHxYq1yL4KbKUv3qtWgTK0A6QbGh87GB3sscrHRIQiG2RrmU_jF4tENr9wGS_YxoUSSDrYjWmrNfeEHSGSc3FyhNLlBU&key=YOUR_API_KEY
You might also want to try this answer from this thread using the Panoramio API.
hello guys i have replaced my GoggleMaps in my application due to its lack of closing map and so clearing heap on demand, and now im using nutiteq instead, and im trying to reach google map's tiles . as the nutiteq has explained it uses parameters likes this :
"http://otile1.mqcdn.com/tiles/1.0.0/osm/{zoom}/{x}/{y}.png"
and the request will be like this :
"http://otile1.mqcdn.com/tiles/1.0.0/osm/3/5/1.png"
but the google's parameters is like this:
https://maps.googleapis.com/maps/api/staticmap?center=x,y&zoom=z&size=400x400
but the request needs a double coordinate some thing like this :
https://maps.googleapis.com/maps/api/staticmap?center=42.05123,-70.31234&zoom=1&
size=400x400
any one who familiar with nutiteq, can please explain how can i make it to use double coordinates instead single integer at the request? thanks alot
You should create own custom DataSource, where you calculate tile center coordinates from x/y/zoom (see code samples here) and make Google Static map request based on this.
There are two questions still:
technical: matching of tiles can be inaccurate and Google logo will be in each tile
legal: according to my understanding it is violation of Google Maps terms of service. Last time when I checekd they allow to use Static maps only in web page, not in native mobile app. If you are sure you can use it (or ignore the legal issue), then why not to use their tiles ?
do you know how can we create our map and show the ways from a certain locations to destinations ? Without using google map , just using a picture of a map , is there any way to draw routes on it?I am not asking projects or codes , just need some suggestions related to drawings and considering the obstacles in the way ?Thank you
You should have your way points in somewhere(maybe in db or in xml file etc) and also for getting map base you should have a map provider like yahoo, bing, google or openstreetmap(which is free to use - no api key needed considering others)
after having these two sources you can use Geoserver(which is opensource map data manipulater and provider) to put these sources together and get them as map base image.
considering your "just using a picture of a map" is an owerwellming issue. Because you will have to do some calculation to find where to put your points programatically. So Geoserver does that automatically.
also I suggest you to hava a look at osmdroid and osmbonuspack they may help.
I am creating my first android app and I have a Google map using the MapFragment and now I need to extract an image of the map so I can place that in a ListView.
I have both a full screen Google map in one activity and a smaller Google map that fills about half a screen on another, taking a bitmap for any of them would be fine, preferably extracting a bitmap from the smaller one.
Please without this my app is pretty much useless. I heard that it is possible in Google maps APIv1 by using getRootView(), is there anything that I can do to get a bitmap or a static map in APIv2.
Follow this link
public final void snapshot (GoogleMap.SnapshotReadyCallback callback)
Takes a snapshot of the map. You can use snapshots within your application when an interactive map would be difficult, or impossible,
to use. For example, images produced with the snapshot() method can be
used to display a thumbnail of the map in your app, or a snapshot in
the notification center.
AFAIK as of now you cannot take a screenshot of the map. The reason is that the Google map v2 for android is based of an extended class of GLSurfaceView(and so is protected by Pro-guard). Because of this the usual method of taking screenshot is not supported.
There is an enhancement request open on Google bug list for this and hope this will be added as a feature soon.
For now, I would suggest to move down to API v1(if you can, because Google has also stopped giving out API v1 keys).
I have searched for hours on the web for an example of implementing the direccions service on my android app.
I am using the google maps android api 2.
Basically I want the directions from the actual position and a marker position selected by the user.
I want to make clear that I donĀ“t want to launch a web browser or the google maps aplication, I want to implement the service on my own app.
Till now I found some examples about drawing the route on tha map, which are ok
http://wptrafficanalyzer.in/blog/gps-and-google-map-in-android-applications-series/
Get driving directions using Google Maps API v2
so I just miss the indications part of the service so y can show on my own listview with arrows (turn to left , to right , etc).
Thanks for reading my question
I'm not sure what you want. In your second link about Google Map API v2, the data for drawing maps comes from maps.googleapis.com .You can see https://developers.google.com/maps/documentation/directions/ for more documentation about that.
The xml returned from maps.googleapis.com include <html_instructions> tag which contains instruction like turn left or turn right. So you just need to parse that xml and use <html_instructions> tag for information you need on your listview.
I hope this helps.