Change DPI with Javascript Google Maps Api - google-maps

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!)

Related

Google map zoom parameter in url not working

Why doesn't google map z (zoom) parameter work inside the url?
I' ve searched over so I got few solutions for sending zoom parameter in google map url but based on the old posts (stackoverflow) which deal with the zoom level within the url it seems that this functionalities do not work anymore.
I've used the following z parameter but it's not working:
http://maps.google.com/?q=38.6531004,-90.243462&z=12
Below is the link where they have mentioned z parameter for zoom level
link
For those who do not want to read,
this works (z range:[1-20]):
https://maps.google.com/?q=38.6531004,-90.243462&ll=38.6531004,-90.243462&z=3
There is no documentation that covers this problem. However, there are few hacks.
The link that you have provided,
URL (stackoverflow):What parameters should I use in a Google Maps URL to go to a lat-lon?
Will not help you with getting the desired google maps zoom level inside a url
The following examples which have been working for quite a while DO NOT WORK anymore (they work but without getting the desired zoom level)
Examples:
http://maps.google.com/?q=38.6531004,-90.243462&z=3
http://maps.google.com/?q=38.6531004,-90.243462&zoom=3
http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=15
Instead, you can get the zoom level easily by trying the following examples:
https://www.google.com/maps/#38.6531004,-90.243462,9z
https://maps.google.com/?ll=40.7060471,-74.0088901&z=3
(Note: after clicking on google maps you will get a gray marker which appears and quickly disappears)
However the above URL's will not give you a static pinpoint for the specified lat&long.
There is a "hack" on how to get a fixed pinpoint (red marker pin) and that is by giving the q attribute (represents the search query) and the II attribute(latitude and longitude of the map centre point) along with the z (zoom attribute)
Example (with the OP coordinates):
https://maps.google.com/?q=38.6531004,-90.243462&ll=38.6531004,-90.243462&z=3
If you want to change the zoom level just change the value of 'z'.
After searching the web I found that only this website:
https://moz.com/blog/new-google-maps-url-parameters
deals with google maps parameters/attributes/arguments, where things actually still work. If anyone want's more functionalities within the url, then this is the site to check.
Zoom intervals explained (https://developers.google.com/maps/documentation/static-maps/intro#Zoomlevels):
The following list shows the approximate level of detail you can
expect to see at each zoom level:
1: World
5: Landmass/continent
10: City
15: Streets
20: Buildings
This works as of 5 Aug 2018
http://www.google.com/maps/place/<lat>,<lng>/#<lat>,<lng>,<zoom>z
For example
http://www.google.com/maps/place/49.46800006494457,17.11514008755796/#49.46800006494457,17.11514008755796,7z
As of 04/2020 ...."because google is always changing and evolving"
In complement to Eugen Sunic comments above, and an alternative update to the Solution.
When Logged in to google and getting map data from the google generator, it is not the same as copying the URL from the browser window (which my may be manipulated to load different zooms trough the various alterations, html, Css and script tricks).
But in the below, keep in mind that Your address info may need to be part of the google array of database, eg you have some address map info linked to your account, images, business name, etc. or not... maybe just typed in for a quick map search with a pin-point... the later I don't know.
Also the below is not some Google API pay per 1k clicks thing, which is more geared to the commercial development end of google tracking heat maps, etc. So if you just need a simple solution and certain zoom and marker to work..then you might try the below.
When logged in too your Google account (maybe not) and showing your location marker on the map screen...
Choose the zoom detail of the map you want to appear in your web page. eg Whole US, State views, City, Street (by clicking the + or - zoom feature).
Then go to the hamburger menu to the left, and look down the list for "Share or Embed Map" and the popup window should load the same zoom level of the map! Do not try to change the zoom in the popup window feature, it wont work to change the link code but will change the pop up windows zoom of the map. In short, the embedded link code is preset and will not change in the popup.
Above this popup window of the map there will be two options at the top (Share and Embed) button/link selections.
Click on the Embed link/button and it should generate the code for the zoom you previously chose.
Lastly, copy the code, paste it into your web page and TEST!
As far as I can tell, There is no altering this code as the others suggested above, changing(z=3, 9z, etc) as the code is entirely different. But it will allow you to get the zoom you need "if the google code generator or procedure does not change".
But the zoom level was altered and good enough for me when I figured the process out. Changing it to other zooms is another can of code.

Is there any limit to number of markers that can be placed on google static maps?

Is it possible to place (say 1000) markers (using set of LAT-LONG values) on Static Google map image?
Also, is there some sort of HTTP POST method to achive this or URL is the only way to go?
Basically, I was looking into Bing maps REST service - Imagery and I found that maximum 100 pushpins (markers) can be placed on to Bing map.
I would like to generate static map with unlimited markers/pushpins. Google or Bing does not matter.
Something like this: http://msdn.microsoft.com/en-us/library/ff701724.aspx#code-snippet-19
As far as I know there is no limit on how many markers you can add to a google-maps based map - however the performance of your map will decrease when you add a lot of them.
There is a nice article on developers.google.com (https://developers.google.com/maps/articles/toomanymarkers) that shows how to deal with lots of placemarks by either clustering them or rendering them on a separate layer.
The documentation for static maps states:
URL Size Restriction
Static Map URLs are restricted to 2048 characters in size. In practice, you will probably not
have need for URLs longer than this, unless you produce complicated maps with a high number
of markers and paths. Note, however, that certain characters may be URL-encoded by browsers
and/or services before sending them off to the Static Map service, resulting in increased
character usage. For more information, see Building a Valid URL.
I am pushing over 16000 markers with no problem at all, not even performance. I am using the javascript API, as long as you can put that into a variable, and push it to the canvas at a reasonable pase (1 per seccond is the speed i am pushing the markers ) there's no problem

How do you plot geo-encoded locations on a custom map?

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.

Google maps ImageMapType - what should getTileUrl return?

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.

Google Maps default zoom level

I created a public map using my Google Map. I want to set a default zoom level, but it is not saved. Is this possible?
Also, is it possible to change the list of place markers?
the reference map that you supply (quebec summer festival) is called by the URL: http://maps.google.com/maps/ms?source=embed&hl=en&geocode=&ie=UTF8&msa=0&msid=112492115201367239282.0004609e0fcc239c4f792&ll=46.81084,-71.217113&spn=0.02056,0.038624&z=15
notice that the last parameter "&z=15" defines the zoom level (in the embed map code, "&z=15" becomes "& a m p ; z = 1 5" [remove spaces between letters]). if you change this you can increase or decrease the zoom level. if you suppress the zoom level, googlemaps will automatically calculate a zoom level when displaying said map. NORMALLY this leaves some of your map outside the frame.
so, just by supplying the URL with the desired zoomlevel you have solved your problem. this works very well with static maps. if you have a dynamically generated map (from a database, for example), the fastest solution is to put 2 markers (top left and bottom right corners) slightly outside your boundary box. this will force automatic zoom in the desired amount (hopefully).
Not using API just made a map points using my GMail account and made it public, like the following site:
http://maps.google.com/maps/ms?source=embed&hl=en&geocode=&ie=UTF8&msa=0&msid=112492115201367239282.0004609e0fcc239c4f792&ll=46.81084,-71.217113&spn=0.02056,0.038624&z=15
Nothing is saved by a web page. HTML browsing is stateless. If you want to save some information you will need to use similar trick as any other web applications. E.g. putting it in cookie and the setting the zoom level using the information in the cookie when you initial the page.