I've read that you can create a custom image map with tiles. Now i've seen a video where this proces is being done with LeafletJS video here
But how can i accomplish this with google maps. For instance i've the following example map of a zoo. How could i use this with tiles in google maps. Could someone point me in the right direction, tutorials, etc.
Creating tiles for map is not trivial task, and there are many utilities for that (e.g. maptiler). You should split your image to tiles, and save it in, for example, assets folder. Also you need implement custom TileProvider like in this answer of Alex Vasilkov.
But, actually, tiles necessary if you have "big" image, which can't be shown wholly due memory restriction, or you have several images for different zoom levels - in that case one tile of zoomlevel becomes 4 tiles of zoomlevel+1. Taipei zoo schamatics is not so big, so you can use GroundOverlay.
With your image as zoo drawable resource, you can use something like this:
#Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
GroundOverlayOptions overlayZoo = new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromResource(R.drawable.zoo))
.transparency(0.5f)
.bearing(135)
.position(new LatLng(24.995517, 121.584058), 1000f);
mGoogleMap.addGroundOverlay(overlayZoo);
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(24.995517, 121.584058), 15.0f));
}
and got something like that:
and it's zoomable, scrollable, rotatable etc.
Of course, it's just example, and you need more precisely referencing, bearing, removing unnecessary elements, etc. Also the image scheme itself is very approximate and differs from the real terrain.
Related
Given an address, is there a way to fetch a static Google map with certain parameters in order to show the entire block including the surrounding streets?
This is the result I'm trying to achieve (I just centered and zoomed manually from Google Maps to make the screenshot):
But when requesting via Static Maps API, using zoom 17 is too far:
and using zoom=18 is too close:
Not to mention that I can't figure out how to do the right centering of the map.
I don't think there's an out-of-the-box way of doing this. There are plenty of possibilities for which block you want to show.
Some complications (there are more, I bet) include:
if you're in a street corner, which of the 4 blocks should the sprite be panned to?
if the address is a park?
if your block has an irregular shape? (even with the rectangular-like blocks in NYC it is complex enough due to their rotation on North axis)
If you have the origin latitude and longitude instead of the address, you could try using the &visible=latLng2 argument for the Static Maps URL, where latLng2 is a modified version of origin including a delta (probably ~0.002 degrees) to make it look similar to your idea. This argument cannot be used with a given zoom.
Before:
After:
Maybe your best option is to go with some calculations in the middle (like Google Geo services to know which is the street around the corner, etc)
I've developed a HTML application that displays a map. This map has many fixed markers (they do not change in time).
Due to that:
I want to speed up the application
I want to hide the marker position from malicious users (so they can't use the information I've gathered for they're own porpose)
I want to convert the markers to a tile layer.
I've been googleing without success how to do this. Anyone has faced this problem and has a nice easy solution?
Thanks!
If the markers never change, there is a great solution:
Mapbox.
You can create your map with the markers, then the mapbox servors will send the tiles with the markers.
You can use a quadkey. It'similar to a quadtree. You can download my PHP class hilbert-curve # phpclasses.org. It also uses a quadkey.
I need to create a 80x80cm (or 33inchx33inch) map with Google Maps. This map will be printed and exhibited, so the higher DPI the better. Actually, in printing, a 300DPI is the minimum.
Now, I'm using the Javascript API in order to create the map I want :
- change the mapOptions with an array of styles with various colors
- add a Transit Overlay in order to have the map of the urban trains added over the map (see this aautar.digital-radiation.com/blog/?p=3761)
- add polygons as a link to KML URL to one of my maps
If you want to see the result : http://www.tellnet.fr/blog/test.html (it's very long to download since it's a 5000x5000 picture).
The problem is that, at the Scale level I want (with not too many details), the big picture I get is a 5000x5000, which gives a 150DPI only printable file.
To obtain a 10000x10000 picture as I would to print a 80x80cm map at 300 DPI, I need to :
- either my map zoom once, but then I've got soooo many details, that will be printed super tiny
- or change the DPI of the map, asking Google Maps to double it.
It would basically give me the same map at the same scale, but with thinner lines and texts (making a 10000x10000 pictures).
I know this is possible with the static maps Api, change the Scale value to 2 (see https://developers.google.com/maps/documentation/staticmaps/?hl=fr#scale_values).
The problem is that, this is the static maps API, so please can someone tell me if :
- it's either possible to do all the above things with the static API
- or change the "scale" value (ie the DPI value) with the Javascript API.
I also tried to change the meta viewport value, but this only works with mobile devices... (I searched for all solutions, now I'm blocked!)
I have a number of events in the US. I have addresses for these events, but it varies in accuracy. Some might be the full address, some might be just "Austin, Texas".
I'd like to plot these programatically on a map on a webpage with a marker as they'll change fairly regularly. The marker should be an internal link to the relevant row in the table of events lower down on the page.
The image doesn't need to be updated on the fly, just on the (say fortnightly occasions) when an event is added (e.g. a cached image is cleared and recreated)
Rather than use Google maps, I'd like to plot these on top of an image like this: http://0.tqn.com/d/geography/1/0/9/H/usa3.jpg
How would I go about putting markers on this image that correspond to the (rough) geolocation of these events?
Your best bet might be to use google maps and plot the locations and then just pull an image of the map - that way you can let google do all the work of placing the pins but not have to worry about people zooming, since it is a static image file.
Beyond that, you can type the locations into any mapping service to get a rough idea of the location and then place markers or dots on your map file in the same location. This would allow you to choose whatever image or color you want the icons/markers to be, since you will find and place them yourself.
I'm new to Google's ImageMapType and I'm trying to use it in order to display a custom map.
I have one jpg image of a map I'd like to display. The image proportions are not exactly 1-1 with the world...
I've read the API but I'm not sure what the getTileUrl(...) function should return - obviously it should return a link to the map image, but in all examples I saw the URL contained x and y coordinates as well as a zoom value. Does this mean that each tile url should have an image with a different part of the map? (meaning I need to create several images from my original map?)
Thanks for the help,
Li
You don't have to create different images, but you would probably want to, otherwise it will be the same image tiled. The x,y and z allow you to distinguish one section of the map from the other.