Style Country - Google Maps API - html

I made a google styled map and now I want to add more features to it. The feature I'm trying to add is a way to style specific countries. I want to let my program select a country and then have that country appear differently on the map and stand out.
This is challenging because there are polygon ways to do this, but that would mean it is hardcoded and the country can't change. I want to be able to use this feature on different countries.
Thanks

I don't know of a way to do this with styles; I think you'd need to generate map tiles with countries coloured and overlay those map tiles on top of what you have already.

Related

Highlighting cities with google maps

I've recently discovered geolocation, it is a wonderful and fun little feature.
I've figured out how to show somebody's location on a map with a little pin and how to fetch the different parts of their address from the delivered data.
One thing I want to do with all this though is given somebodys location to then highlight their city.
I know that now with google maps if you type in UK postcodes or Japanese cities this can be done, however it gives a very difficult to see outline around the location. It doesn't fully shade it.
My ultimate goal is to shade somebodys city a different colour depending on certain variables, the actual google maps content beyond the basic 'this is where the city is' is unimportant (working out these variables and colours is of course a different area and not the purpose of this question).
So...sorry for my poor English here. But I woder. Is there anyway, given a certain input which on default google maps would give the outlined administrative division, will shade the city a given colour?
Bonus points if you can do more than one city at once (ultimate goal- show their surrounding cities as well as their current city)
I'm doubt you can do it for google map as there seem no way to retrieve google map boundary data. The alternative that I can think of is the use of OpenStreetMap with Kartograph library. This possibly could give you a solution, but you need to manually generate the border out from the OpenStreetMap and color it using the Kartograph library.

How to combine table/chart with (Google) Maps (stats)

I want to use Google Maps or another Map like Openstreetmap to make an interactive site where people can see the stats of crime in their own area... I want to put in these stats by myself via the backend. The front-end must be something like this:
http://www.police.act.gov.au/crime-and-safety/crime-statistics.aspx
Where do I start with this? Is this a polygon? I have read the Google Maps API but I could not find a clue to make something like this. How did they put the stats in it? How can I color the area's and divide them? What did they use? Any direction would be very welcome.
PS: I want to have a detailed map. So no countries or cities, but the area's in a certain city have to be highlighted.
What I can suggest is that first study the developer documentation thoroughly for Google API v3.Basics will help a lot.
For pointers to your needs, you can get help in defining polygons and coloring them at this link https://developers.google.com/maps/documentation/javascript/overlays#Polygons and also check out the demo examples in the code.
For a 3 point polygon, here is an example https://google-developers.appspot.com/maps/documentation/javascript/examples/polygon-simple
You can define your polygons by adding points around your area. There are many tools available to find your pointer locations like http://martinove.dk/maptools/polytool/
In order to potray data, you can use markerclusterer. These examples can help:
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/examples/

How to hide certain locality labels on a custom Google Map?

I have a custom Google map set up with custom markers for certain points with popup infowindows. I currently have it setup to show all locality labels (eg city/area labels) however the client has asked if we can hide certain localities and not others (so that the relevant areas of interest are always visible but the irrelevant ones are not). You can obviously set it to hide all localities (or other items on the map) but I cannot see anyway of only displaying certain ones? Does anyone know anyway of displaying certain ones and not others?
If this is not possible then presumably the only alternative would be to hide all locality labels and setup 2 different styles of markers, one that is a normal marker withpopup and one that is actually just a text label with no associated popup which can then be used to list the relevant locality labels? Presumably this is possible but is there a better way of doing it as this doesn't seem right?
Thanks so much,
Dave
I'm assuming from your description that you have created a MapTypeStyleapi-doc. And no, there is no easy way, using a Styled Mapdev-guide, to apply a style to specific geographic areas; it just provides the hierarchical model of styling rules.
To answer your specific question about how to create markers that function essentially as labels, the MarkerWithLabel utility library will provide you with a tool that does what you describe. That said, I wouldn't recommend trying to recreate a set of map labels for an area or region using markers; the misgivings you express in your question about this approach are valid.
If you need to implement something along these lines, I suggest taking a look at the following two options and considering if either of these are a good fit for what you are trying to achieve:
Custom Overlays
KML Layers

Creating custom overlays for Google Maps

I have a set of addresses, lets say restaurants, which I would like to plot on Google Maps and then make it possible for the user to rate them. I would also like to provide a search feature where the user can filter the restaurants by e.g. rating, food choice etc.
I have created the database architecture to store the restaurants and ratings, but how should I go around creating the overlay?
Are there already a feature where I can pinpoint an address and then supply my own html-code/iframe or alike, or do I need to create the overlay from the bottom myself?
I have looked at the overlay API, but I can't seem to figure out what is the best way to go around doing it?
I found out that the InfoBox would work.

Easiest way to create a dynamic heatmap of the United States

thanks for all the help the last few days. I'm hoping someone knows this one.
I'm looking to dynamically create a heatmap of data based on user input, then color certain states based on the response. Like a poll for voting, for example. I'd like to do something like this...
http://www.trulia.com/home_prices/
What is going to be the easiest way to do this?
The Google Chart API also offers maps.
Here's a (completely made up) example:
Another very easy solution is OpenHeatMap.com. They support pegging data to a variety of map shapes, including US states.
OpenLayers is a javascript library for displaying tiled maps and related elements (polygon, line, etc) on top of these tiles.
It supports a number of back-ends for map data, including google's data.
Samples are available here