Using nutiteq to Get GoogleMap's Tiles - android

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 ?

Related

What libraries to use for Android Project with maps and routing?

Alongside with my friends I am about to develop an android application. The application will use maps a lot, finding routes, placing markers, drawing predefined routes, stuff like that.
There is this Google Maps APIv2. So I tried it, write some code and looks good. I am able to place markers and draw polylines, however my application will have some predefined routes. One route is set of LatLng points. So I just add these points to PolylineOptions and add it to map. Great, it works.
But these predefined routes will be created in web-based application also using Google Maps APIv2 or similar api/library. Some streets are not straight they are curved so you need to create a lot of LatLng points to get it look nice which is very important. I can do this but I want to put only two LatLng points - at the beginning of the street and at the end.
Here is the image:
On the left, route has only two LatLng points (red dots) and that is desired shape of line. On the right same route with 2 LatLng points gives me route coloured in light blue, and this is what actually happens if I just add polyline to GoogleMap object. In order to create same effect as in left image, I need to create many LatLng (red dots) points which is not appropriate for those who will create these routes. So this leads us to routing problem which can be solved by using Google Directions API. Which solves the problem of drawing routes with less markers. Basically what I understood, this API for directions actually creates a lot of these LatLng points that I draw using for-each loop as seen on right part of picture above. And I need to contact Google Web Service for this so I need to have Internet connection - and this is the problem.
Sometimes internet will not be available hence I need some alternative solution. I've heard of Open Street Maps, but I am not sure how to use it and does it needs internet connection for creating these routes.
Is there any free library that offers offline routing and showing maps offline? Basically all map interactions must be done without use of internet.
But it is understandable if internet connection is needed only for the first run of application as it is needed for Google Maps APIv2, well application crashes until I turn on internet, after which any next run I do not need internet..
A web based application will be made for creating these routes and routes will be created by users for whom we develop this application. And as users can be very annoying they will demand some user-friendly and easy interface for creating routes. Telling them that they need to create 100 to 500 points for each route, and if there is 60-70 routes they will gladly say NO to our application.
Any advice? If it is possible, I can write my own routing algorithm for Google Maps to work offline, I am very skilful at "Algorithms and Data Structures" - any guides/tutorials for this? But I guess this map is just set of tiles, and does not have necessary information for finding route.... So please correct If I am mistaken for anything.
You can use the Scout SDK (provides a free usage quota) as it offers full offline maps, routing & navigation.
Have a look into the open source projects GraphHopper, Mapsforge and OpenScience-VTM which can do routing and/or maps offline. And all use OpenStreetMap data. Other projects exists of course, have a look here and here.
Also have a look into the GraphHopper map matching component which could be interesting for your specific use case and can work offline too.
(Note I'm the author of GraphHopper)
If it is possible, I can write my own routing algorithm for Google Maps to work offline
No you can't, the data is not open nor you can buy the data to my knowledge.
Another option is OsmAnd. The OSM wiki also has some information about OsmAnd and even more information about OSM on Android in general as well as pages about rendering and routing.

Custom Google Map Types

I'm looking for a way to use custom map tiles with the Google Map API V2 for Android.
I'm writing an application that will create it's own maps in real time with data that are comming from a robot.
The application need to show to the operator this map. The operator need to interact with this map, letting way points, etc.
I want to use the GoogleMap engine in order to do the same that in this page :
http://cdn.mikecouturier.com/blog.mikecouturier.com/tilesgenerator/index.html
The problem is, this guy use the [javascrip API]
But me, I want to use the [Android API]
Are there any way to use Custom tiles map on android with the GoogleMap Engine ?
Thank's a lot
PS : I'm already looking how to use ArcGIS. But, i prefer using API without paying license, thanks
By using GoogleMap.setMapType(MAP_TYPE_NONE) you will get an empty map.
Using e.g. the CanvasTileProvider I have described in the answer to this SO question you may then draw anything into the tiles.

How to identify the roads on the map to route just as Google Maps does?

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.

Creating an application using the google maps api that has a custom layer over top

So, my question is somewhat of an odd request I think. I was an intermediate java programmer making android apps a couple years ago, but I quit for other things. Now I'm back with a new and (I think) somewhat bold idea and I need help.
I'm wanting to know if it is possible to utilize the google maps api to act as a base for another map that I layer over the top. Think of it as I'm changing the way the map looks and that's about it.
I'm wanting to create a mobile app that has a map with a new/different look than what the base and satellite views have for a set small area of the city. Think of it as something like taking any old image and slapping it over the top of the google map and still being able to navigate with it (obviously if it was a random picture you wouldn't be able to see where it was taking you, but in theory you could essentially create a new map).
Is this possible in both java and obj c?
As far ask I know, you can't add your own tile layer to the Google Maps API for Android. However, you can use osmdroid and add your own tiles. You could also use mapsforge for Android. It comes with it's own tool for creating custom map tiles.

Google Static Map without using google Map API

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

Categories

Resources