Is there a way to find all Overlays attached to a map? - google-maps

I have a gmap object that is created by a JSF components (PrimeFaces p:gmap) and it might have some Overlays (Markers) attached to it. So my own client-side javascript doesn't have a direct reference the Overlay objects.
Is there some way where I can get a collection of all the Overlays currently painted on a map?

with v3 of the Maps API, no. There is no documented method to do this.
A internal array somewhere might hold it, but you couldn't rely on it ( and its obfuscated short name would change with each release).

Related

Google Maps with night view?

Is it possible to use with google api v3 something similar to this: https://earthbuilder.google.com/10446176163891957399-13737975182519107424-4/mapview/
Should I use google map engine to apply the night view overlay?
Please advice
The link no longer works, but assuming you want something like Google Maps' "night mode" (that automatically activates when navigating during night), yes, it's possible!
You need to use map styling, as described in this official documentation.
With style options you can customize the presentation of the standard Google map styles, changing the visual display of features like roads, parks, businesses, and other points of interest. This means that you can emphasize particular components of the map or make the map complement the style of your app.
(...)
To style your map, call GoogleMap.setMapStyle() passing a MapStyleOptions object that contains your style declarations in JSON format.
You can use the Maps Platform Styling Wizard as a quick way to generate a JSON styling object.

Custom layer/overlay in google maps

Is it possible to create custom layers/overlays in google maps?
As an example, would it be possible to have one layer with polygons, another with circles, and a third with markers? and then hide/show these layers individually?
I tried looking at the documentation, but the layers seems to only be a fixed set of predefined layers. And overlays seems to only support image overlays.
Any help on this is appreciated.
I'm not sure if there exists a better way to do this, but I've found a workaround to a similar problem. My example utilizes markers and polylines, but it should be easy to extend the functionality to circles and polygons too.
Link to JSFiddle
Basically it works like this:
Initialize the map.
User selects an option what he would like to see on the map.
Click triggers a method (see HTML part of the fiddle) in the map object that first clears the map and then pushes new overlays on map.
The data that is currently shown on map is stored in arrays, and the map clearing method simply goes through these arrays and checks if there exists any content on map, and removes them if does.
Hope this helps. Cheers!

Convert google map v2 custom overlay to v3 custom overlay

I have been doing so much research and yet to find the exact answer to help me. I need to convert my map at http://www.uaf.edu/campusmap/ from V2 to V3 so I can try to combine it with my fusion tables. It uses tiles made by Map Tiler. Is there anyone who can help me out?
I guess you need to port the whole map to V3 and use Custom Map Types.
BTW, you're loading the API twice, once from http://www.uaf.edu/files/campusmap/ and then again from http://www.uaf.edu/files/campusmap/campusmap-122311.html -- which is loaded in an iframe. Probably better to remove one of them, I think you can get rid of the first one.
I think there are two main things you'll need to worry about when converting to v3:
GTileOverlay doesn't exist in v3. You can use Custom Map Types, as per the pp.
To do this, you'll want to make an ImageMapType (see the docs). You'll then need to add this to the Map.overlayMapTypes MVCArray (which will display it above the base map - Map reference).
There's nothing like GDownloadUrl and GXml for downloading and parsing an XML document in v3. You'll need to use a generic library like jQuery to help downloading your marker locations.

Google Maps: Traffic on top of Custom Map

I want to add traffic information to my custom map. Currently I'm using a Tile Layer Overlay on my Google Map to display custom map tiles. When I try to add GTrafficOverlay to my map, my custom map tiles display above the traffic information. Is there any way to display the traffic above my GTileLayerOverlay?
(Using the JavaScript api)
You should be able to do this in V3. Take a look at this sample: http://code.google.com/apis/maps/documentation/v3/overlays.html#ImageMapTypes
I tried this out and wasn't able to find a solution to the problem. There is nothing in the GTrafficOverlayOptions and I couldn't find anything in the references about the z-order of this stuff. I have suspect that this isn't possible.
Would love to see an alternative answer showing that I am wrong.

Web-based UI element for selecting a geographical location

I'd like to create / use a UI element for a web-site that provides a world map, on which the user can draw a circle to indicate an area of interest. I'd like information on the coordinates of the area covered by the circle to be available to me via Javascript for sending back to the server over Ajax.
Does such a control exist, and if not how difficult would this be to implement using something like Google Maps?
Google would have that as part of it's api as would OpenLayers
maybe Artem GoogleMap can help you.