EXPORTING A MAP REPORT TO EXCEL OR PDF - google-maps

i am an Brasilian Web Developer, and i am making an report of phone calls geolocation in an virtual PABX ( asterisk ), already working fine with google maps API V3.
OBJECTIVE Export this report into a PDF or Excel, so i am thinking in turn the map into a image, to export after:
What i already try:
Create a Static Map dont solve my problem because i have a marker for each calls, and i am clustering markers with MarkerClusterer
I converted my map in Canvas using html2canvas, after my html turned in canvas i used canvas2image to create an <img> element, for simple html this solution works perfect, but in case of google maps the result is that:
Unfortunately i cannot post images because i have no reputation, i always visit StackOverflow but its my first time making a question, but i can describe that the image generated from the canvas have just the gray google maps background and the number of markers of the markerclusterer.
You can see the image here to understand better:
I am thinking in something like take a screenshot of the page and crop to just pick map region, but any sugestions that can solve the problem or give me a way will be very welcome.

Related

Placemark not all displaying using google map api

First time asking a question so sorry if it's not well worded. I'm trying to display a placemark over every country with a custom icon for each (their flag), using a KML file. If i look at the file using google earth everything works fine but when its loaded on google map it only displays a small number of them (around 20). Does anyone know if there is a limit for custom icons on placemark? https://developers.google.com/kml/documentation/mapsSupport according to this i don't think so but im kinda lost.
All the links to the png imgs works.

Query existing, public Google Map via the Google Maps API v3

I am trying to embed an existing, public Google Map into a website. Specifically this one:
http://goo.gl/maps/cHf2
Of course I could use the iframe embed to achieve this, but I would like a little more control over the map … I imagined being able to pull all the markers from the map and display them as an index next to the map. Kind of like Google already does, but embedded in my page with my own styles and images.
I have been digging through Google, Stack Overflow and the API instructions and couldn’t find any relevant posts. In the GET string of the map on Google we can see this chunk:
&msid=212828439842926497866.0004bfae4da003d8ffd1f&mid=1341413217
I thought in there might be a maps ID and I could use it to query the content of the map through the API? The intention is using Google Maps as a CMS for less technical minded people and not dealing with geo data in our own CMS.
Any help would be greatly appreciated. Maybe I am just missing the forest for the trees.
You can download the kml that specifies the markers in that page and display that on your API based map. This example defaults to displaying it using geoxml3, but you can hide that and display the KmlLayer version.
You should be able to just point KmlLayer to the link (I downloaded the kml and put it on my server so it would work with geoxml3).
Here is an example (taken directly from the documentation) that does that
here is the original

Max url length with Google Maps static image

I need to create a static image of google map with several markers, and each marker has a custom icon.
In the Api DOC there is the note: 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.
The url is very long.... There is the position for each marker and the URL for the custom icon for each one.
I've already tried with POST request ma it is not supported.
There is another way to create a static map image without max length limitation?
A possible way might be this, but i don't know if is it possible: I've create my custom map using the function in GMaps, and i have added all the markers i need.
There is a way to access in static way to this particular map? so in the url i have to give only the center of the map and other parameters (zoom, ...), but all the markers are already positioned.
Or... another idea... Can i submit the URL of a KML with all markers positioned instead each single marker position+icon url?
FYI, Google recently updated the limit to 8192.
Have you tried using a URL shortener for the icon urls? I believe the static map API will respect services that make URLs shorter... might save you a few characters.
You might wanna check out toopola´s API to help working with Google Static Maps, I am about to make my own attempt.
Another idea
find map area that contains all the markers
divide the map area into rectangular pieces (4 pieces for example)
create image url for each part, but include in url only markers and icons visible on map
show images
Мethod of division depends on the markers position.
Yes, you can definitely do this with the Javascript API.
I have built a few applications using that API. It can be a little tricky to get your head around, but it is pretty good. For what you want to do, it would not be too difficult. If the user has to be able to interact with the map and add pins and such, it starts to get a little more complicated because you have to capture clicks and such.
Does the map its self need to be available as a URL, or does it just need to be embedded on some page and that URL can be used?
The Javascript API will work best if you can embed the map into an existing webpage.

google maps: find out coordinates

i'm parsing some html data which has google maps embedded (displaying just one certain point) and i was wondering:
how can i find out the exact geographic coordinates of that point?
thx
I will look into this further but if you are able to see the Google Maps representation, you can type this into your browser and it will pinpoint the exact center location:
javascript:void(prompt('',gApplication.getMap().getCenter()));
Very useful if you want to get quick lat/long values. Is this the kind of info you need?
Parsing HTML files and want to find what point map is displaying?
This is likely not be possible (correct me if I am wrong). The map is a JavaScript object that only exists inside a browser - it is only text code in the html file. Map variables and data only exist inside the JavaScript engine running inside the browser, their dynamic variable state cannot be stored in a file ahead of time.
If the site is displaying a static map image then we have a different story. Just parse the URL to google static maps requesting the map image.
i found out that the actual coordinates were stored in the html :)
Have you tried the LatLng Marker lab in google map?

How could a share a Google map mashup with my own datapoints and links back to my site?

I currently have a map mashup that has locations that I'm populating from my own database. A few users would like to also show that map on their site(s). I'd like to give them the ability to do that, but would like to retain the actual functionality of the map on my own site: like add "stuff" to places on the map through my a web form on my site. I could open the entire API to allow them to create their own form along with the data points, but most of the people wanting to put up the map aren't developers, they are just enthusiasts that have put together a personal page that they want to spice up.
I was thinking I could just provide a JavaScript of some kind that they could then take to place on their site, or maybe an IFRAME of some type, or...any ideas? Anyone implemented this? TIA.
I haven't done anything like this myself, but I think your idea to utilise an iframe is on the right track. In fact, this is how Google Maps generates its embed code.
Your app will need to generate a URL with all relevant Google Map parameters such as bounds, zoom level as well as your application-specific params. Any event that triggers the map to re-draw (drag, zoom, etc.) will generate a new URL.
If you try the embed link in Google Maps as an example, it generates a URL that looks something like this:
http://maps.google.com/maps?f=q&source=s_q&sll=45.434035,12.339057&sspn=0.003294,0.004812&ie=UTF8&ll=45.432724,12.338966&spn=0.006588,0.009624&t=h&z=17
This URL can then be wrapped up in an iframe which your end users can place on their web pages.
Re: resizing
Yes, it's possible to dynamically resize it if width/height is part of your application params that generates the embed code. Again using Google Maps as an example:
<iframe
src="http://maps.google.com/maps?f=q&source=s_q&sll=45.434035,12.339057&sspn=0.003294,0.004812&ie=UTF8&ll=45.432724,12.338966&spn=0.006588,0.009624&t=h&z=17&output=embed"
width="(width-param)" height="(height-param)"></iframe>
If you mean resized by user, after it's been displayed, I'm not sure.. most likely, yes.