I am using GeoServer for extracting polygons from shapefile then I use them with OpenLayers JS API and project them on Google maps base layer. All set, everything works fine.
I display 2 WMS layers over Google maps base layer, they looks fine in print preview in all browsers but when I print them
FireFox: Got correct print, all the layers printed correctly.
IE/Chrome: only last layer added to map is printed if its not gmap layer.
map.addLayers([gmap, wms1, wms2, vectors]);
here the polygon from wms2 is printed, if I switch them then wms1 is printed and google layer is never printed (even if I put that in last).
Please suggest if you know any workaround or any problem in the way I am doing it. I have already checked advanced option in IE to print image and background but no effect.
Thank you.
Anybody?
Solved.
The problem was with 'opacity': 0.80 parameter while getting polygon from both WMS layers.Although I don't know it for sure but it's the problem with printing Opaque images in IE/Chrome.
In case anybody face the same problem, don't use opacity.
Related
I have a google map where I load geometry data* to the data layer using addGeoJson. Everything works fine until i tried to bind an event on polygons in order to change opactiy settings.
*I retreive city borders from OSM to draw polygons, I think my json object is well formatted, I took Google as reference : https://storage.googleapis.com/mapsdevsite/json/google.json
As soon as I click on a polygon (any of them), it seems to duplicates my polygons anywhere around however the opacity change correctly.
I used this as exemple for my code : https://developers.google.com/maps/documentation/javascript/examples/layer-data-dynamic
Here is my JSFiddle : https://jsfiddle.net/fmarrot/k7b57egw/ (the data can be seen in console.log(Config.polygon) (line 10)
Indeed if i comment line 29 to 31, no problem at all, but I can't change polygon opacity anymore.
map.data.addListener('click', function(event) {
event.feature.setProperty('opacity', (event.feature.getProperty('opacity')===0.5?0.9:0.5));
});
Any idea of what I am doing wrong ?
Thanks for your help !
Ok I think I figured out, it seems to be a Chrome bug (my version 58.0.3029.110 (64-bit)), I've just tested it with Firefox, Edge and IE with no problems > no polygons duplications on polygon click and works like a charm !
I am gonna wait for a chrome fix or if someone have a solution I would appreciate any suggestions !
UPDATE
As stated in Google issue tracker, the issue was fixed in Chrome 60. The corresponding bug was marked as Fixed on August 9, 2017.
https://buganizer.corp.google.com/issues/38211242
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.
A lot of my clients(companies) want to print google maps (with directions) on b/w printers. But when we tried to do this - maps became agly because google maps has litle contrast and small resolution. As a result - everething on map isn't clear visible. We tried all possible settings of the printer and nothing couldnt help.
How to solve this programly? How make google maps (with routs on it) contrast ang good resolution?
Try reading the Styled Map section of the Google Maps API. They even have a wizard that could help you create a grayscale map.
Not a direct answer but something that indirectly solved the problem for me.
Overview - use freeware image editor 'IrfanView' to 'flatten' the image to b/w, using a custom threshold (not supported in standard IrfanView).
copy the map image from Google maps to the clipboard
paste into IrfanView
install the free 'threshold' plugin into IrfanView
3.1) Download FineThreshold from http://www.mehdiplugins.com/english/finethreshold.htm
3.2) Unzip it and save it in a known location.
3.3) In IrfanView, go to Image / Adobe 8BF Plugins / Filter Dialogs.
Use 'Add 8BF filters' (file) to locate and load the filter.
Use 'start selected filter' to invoke the actual filter.
Note the 'ok/cancel' buttons remain grayed out but work.
I found ~228 was a good threshold value for Google Maps. Just slide around that mark, and see when the background switches from black to white. You have to hit 'ok' for each value to see the impact. Then you have to exit the plugin to return to the main IrfanView window.
Try http://www.openstreetmap.org , select cycle map (on stack top right). Labels are slightly bigger than on Google, contrast is better (still not great)
this looks better fit for your need
https://snazzymaps.com/style/79/black-and-white
you can print with markers and labels also.
This is driving me crazy. I've been developing some simple embedded Google Maps such as the following:
http://publicworks.snoco.org/rdclosures/snocordclosuregmaps.html
This map in particular has several kml overlays but one of them is no longer displaying the custom placemark icons I had developed and specified. The problem KML layer is this:
http://publicworks.snoco.org/RdClosures/SnocoRdClosures4Gmaps.kml
Some time in the last few months, the custom symbols stopped displaying and have been replaced by the default placemark symbol. If you open the KML file in Google Earth, it displays properly. The KML file does validate using KmlValidator.
Through my searches on here, I saw a suggestion about using definitions at the top of the KML file and then using within each Placemark. I made that change to my KML but it did not appear to make any difference (the custom icons are still not displaying).
I realize that KML files get cached on Google's end so if you look at my javascript code, I'm using the dummy parameter trick with my KML URL path to force a refresh of the layer. The other thing I will note is that the content of this KML is not static and it frequently changes.
Any ideas? Because I'm stumped!
THANKS!
Steve
Agreed with fragileninja that something is happening with your images between your server and Google's. The usual suspects are timing out and 404s (or other server errors).
Since the KML layer is actually being rasterized to tiles on Google's servers, the request has a relatively short timeout so the tiles aren't delayed from being sent to the browser. If the icon images aren't returned in that time, usually Maps will render using the default icon (as it's doing here). However, I also have no trouble getting the icons to work when I host them on my own server, and I don't see atrocious loading times when I access your icons directly, so it is strange.
It's possible that your servers are taking a longer than usual time to respond to Google's servers specifically, or even that they're returning some HTTP error to them instead of an image.
Can you check your server logs to see if you can see the requests and if they're returning as expected?
Finally, if there's no problem there, I would suggest filing a bug on the Maps API issue tracker. Make sure to pick the appropriate template from the dropdown list (you might also consider making a simpler test case, like just using your KML file with the KmlLayer example from the docs) . If you do end up filing a bug, please link it here and I'll make sure it's looked at.
It's something to do with how your server is serving up the images. If I host the icons on mine, it works fine, and your other KML files are using icons from maps.google.com, which also works fine.
Since it works in GE, I'm guessing maybe your server is sending the wrong MIME type or something along those lines. I checked with curl and everything looks fine though, so I'm afraid I can't offer any more details than that. Hopefully this helps get you in the right direction. Good luck!
I am using Google Map Version 3 API to add markers on Google Map.
The problem is that, markers show up on browsers.
but when users print the map through browser's print command, nothing shows up.
The question is,
- How can I display markers on printed materials? -
Comparisons:
On the browser - markers are clearly visible
After Print (IE7, IE8) - markers are not printed (on paper or PDF)
After Print (FireFox 3.5.4) - only markers are printed
I suggest you try out the Static Maps API. You can build a url that will return a static image (you can build your custom markers into the URL).
The browser will do a much better job of printing an image than it will do with a dynamic Google map.
I was able to print markers by using MarkerWithLabel in place of Google's Marker class which uses images in place of canvas.
In my print dialog there is a checkbox "print background images". When I enable it, the markers are printed. This link can help you: How can I force browsers to print background images in CSS?
I had no issue with printing the markers.
I've created my own markers and I use an <IMG> tag to stick the marker icon in.
The markers print fine on IE 8 on default settings.
Please find the link given below:
https://gist.github.com/jawsthegame/6801698
Using this you will be able to print Google Map along with custom markers.
You only need to make a change at line number 17.
Replace container.clone(); with $(container).clone();