add css to google maps v3 polylines? - javascript

is there any way to customise google maps v3 polylines
I think the only options mentioned are strokecolor, weight and opacity
http://code.google.com/apis/maps/documentation/javascript/reference.html#PolylineOptions

As far as I know, the only options to style Google's polyline are the ones presented in the documentation. There is no way to customize them further by default.
However, what might work is creating a custom polyline class where you can define everything you want, but this is connected to a lot of work. You would have to start by inheriting the OverlayView class and implement all the needed features (Maybe it does also work if you inherit Polyline and overwrite just the drawing methods - the problem is, you don't really know how the original source code looks like).
In fact, for Google Maps V2, Bill Chadwick did this. You can see a demonstration on his website (the dashed polyline example at the bottom). Maybe his implementation helps you to transfer it to Google Maps API V3.

Related

Blank map MapType wanted in google maps v3

I'm trying to find a way of producing a solid color map in Google Maps v3 API, making that another selection in my drop-down MapTypes menu. My understanding is that was possible with v2 using MAP_TYPE_NONE, but I can't find a comparable functionality in v3.
I find I can produce gray background using
MaptypeTypes.push(new gmaps.ags.MapType("http://",{name:'No map'}));
but besides being a kludge, that takes around 5 seconds to kick in. I do want to do something via the drop-down MapTypes menu, which I assume means via the Map Registry, rather than having to create a new button solely for that purpose.
FWIW a working example (with kludge) is at http://bigsurtrailmap.net/route_metrics.html
Yes, you can do that. Check the documentation about Modifying the Map Type Registry and creating Styled Maps.
A good tool to help you build your custom style is the Styled Maps Wizard.
Hope this helps!

tiled textures across a google map in javascript

Using the google maps v3 javascript API, it's possible to add 'GroundOverlays' as a picture. Have a look here:
http://jsfiddle.net/9YYJB/1/
However, I'm working on a project where I'm trying to add a texture to the whole world map. Obviously I can add a single, absolutely massive gif/png overlay but I'd rather add a tiling texture. I've been digging around in the API and can't find any way to do this.
Anyone have any ideas on how this could be done?
Thanks very much
Yes, what you want to use is an image map type. This allows you to add tiles on top of the regular Google Base Map. If you want to completely replace the Google tiles, you would need to implement a Custom Map Type. My favorite example of that is the Liberty City Map.

Give different color to each country in google map

Does anyone know how to give a different color to each country in a google map?
e.g:
in the world map
Blue overlay to UK, then RED china...etc
I wonder if google provide API to give color to each country
Thanks
Using Google Maps this is really not easy, as #oezi said you would need to build overlays of every country you want to color, which frankly sounds like a mess.
But if you don't need all of the functionalities of Google Maps, perhaps you can use a Map Chart from the fantastic Google Chart Tools (aka Chart API). You can check and tinker with a working example of a Colored Map (among some others) in the interactive Chart Wizard
2017 UPDATE: This answer is quite old and as such the Map Charts API has been deprecated by Google. You can use the Geocharts from the Google Charts API instead:
https://developers.google.com/chart/interactive/docs/gallery/geochart
Hope this helps!
you may check this question,it's the same question you are asking.
How to color countries using google maps?
it's talking about google Geocharts in google maps.
there is a possibility to change the map style. and there is a very nice interactive example here - but, as far as i can see, it isn't possible to change the style of a specific country using this, so you'll have to build your own overlays using polygons.
First, find the shape file in .kml format. Tip: try googling "kml uk" or "kml china".
Once you have the KMLfile, host it somewhere and then call it as a var inside your Google Maps API initMap like this:
var myCustomRegion = new google.maps.KmlLayer({
url: 'FULL_URL_TO_YOUR_SHAPE_FILE',
map: map
});
Now your shape is laid into your map.
You can style the shape using the <LineStyle> and <PolyStyle> tags inside the KML file itself.

maps on my own server with google maps api

I want to make a website that displays my map, has panning, zooming and other features.
The google API seems to be the right thing for me. Just one question : Can i use the google javascript api with my own map images on my own server. I dont want to use the actual google maps, just its capability to display zoomable/scrollable maps in a browser
Technically this may be possible using the Overlays section (Ground overlays allow image overlays on the map) of the API and hooking half a dozen events to handle the redrawing at different zoom levels, tiling, hiding the real information about whatever location Google Maps thinks it is showing, etc.
But it is definitely not designed for such purposes and I'm not sure if it would be legal to use it in that way, would have to read the license.
There are other alternatives out there that would be able to achieve this functionality without the level of work needed to get Google Maps to cooperate I believe.
No, I don’t think so.
You may also want to look at OpenStreetMap. I have seen custom map-images being used with its interface.
I think you'll find that the Google maps interactivity code is geared towards working with Google map servers for the underlying map. However, you could put your own layers over their maps and then serve up your own content so long as it used the same mapping co-ordinates.

Replacing Google Maps with Cloudmade map?

I'm trying to implement something like Paul Kulchenko's datamark:
http://notebook.kulchenko.com/maps/datamark
and I was wondering if there was a way to replace the Google Map with a Cloudmade one. I realize now that there's Google's Styled Maps tool, but I'd like to know of a Cloudmade map working with Google Maps API classes.
Thank you, and Happy Holidays!
Google Maps lets you place your own custom tile overlays on top of (or instead of) the default tiles. See http://code.google.com/apis/maps/documentation/javascript/overlays.html for documentation on this, or http://wiki.openstreetmap.org/wiki/Google_Maps_Example for some OSM specific examples.

Categories

Resources