Display country names in Google Maps - google-maps

I have code like this that sets the map type to Terrain View:
map = new GMap2(document.getElementById("map_canvas"));
map.setMapType(G_PHYSICAL_MAP); //Terrain View
The G_PHYSICAL_MAP type used to display the country names, so Google must have changed this recently. Is there a way to add the country names back?
This is how the terrain map looks now without country names:
Current Terrain View http://img413.imageshack.us/img413/3756/terrnoname.jpg
This is how it was a few weeks ago:
Terrain View with Country Names http://img13.imageshack.us/img13/2466/googlemapsterrain21.png
Thanks.

The country names on the terrain map were part of the map imagery (before they disappeared). Unfortunately there seems to be no way to request different map imagery that includes country names.
The only option I see is to define your own map overlay on top of the terrain map, with all the country names. (Probably not practical and not easy).
1st EDIT: As suggested in a comment below, if you plan to add large overlays over the terrain map, you may want to use the open-source tool MapTiler (for Windows and Mac OS X). MapTiler will automate the tiling process for you, and in addition, once the tiling process is finished, it will generate a simple HTML viewer. If you are adding the name of just one country, you may want to use the GGroundOverlay instead. (Google Demo)
2nd EDIT: Note that this issue has been acknowledged by a Google employee on January 20th, and therefore you may want to consider waiting for a few days to see if it gets sorted automatically, before you commit your time to fix it.
3nd EDIT: This has been fixed a few weeks ago by Google.

Related

Set location on google map

I have created one small application, where user can store his/her contacts with full address including map. Therefore I am using the Google Maps API, where user can point out his/her address.
For this I have given address fields with Country, State and City. When user entered this information, I am showing the default address on Google Maps, then the user has to drag the marker/pointer onto his/her exact location.
Now, in this case I want the zoom level of googles map to be set as per location's population.
This means if the user entered city with no mans land (less population or any desert place or any jungle place or very small area on city then zoom level should be more, so user can see proper area on map) otherwise zoom level should be less.
Can some one guide me how to do this?
This won't be possible using the Google API's alone, (I'm unsure if demographics info has been released for the US, I know it was in the works, but it certainly won't work elsewhere). You will have to find an external source to provide your demographics information for you.
The Google API's do not keep a public record of population density.
You could however be a but more tricksy and use an approximation. You could for example do a places search in the area (using an arbitrary radius), count the number of results and use this to set your zoom level (again using an arbitrary value to determine high/medium/low etc). It's a fair assumption (though still an assumption) that any area with a large number of 'places' returned will be densely populated.
You don't need to base this on the population of the location. Please check the follwing link. I think it should give you an idea of the options you have.
Google Maps API v3 - Geocoder results issue with bounds
Check both my question and my answer. You will probably want to use the viewport object.

Partition a map into uniform regions

I'm trying to build a web site for visualization of some statistical information using Google Maps. Effectively, what I'm trying to do is to divide the map into adjacent cells(for example the honeycomb pattern) and for each data point, identify which cell this belongs to and aggregate all points that belong to one cell so that I can display some statistic about that cell on the map. Is there a simple way to get this done using Google maps and d3.js?
Please note that the map we're talking about includes just one city and all my data points are within this city. Also an important step here is to identify which cell on the map a lat/long coordinate belongs to and this is where I'm facing challenges right now.
Thanks in advance.
There is a D3 plugin called hexbin that seems to be exactly what you're looking for. You can see examples of its use here, here, and here. You should be able adapt these for use on any scale map: city, country, or otherwise.

Google Maps Android - set too many markers

My question is, What is the best way to set to many markers on google maps on android program? I have a sqlite database with longitude and latitude for every markers.
For example add all markers 1km around the current location
Get the range of longitude and latitude on moving map and display markers between that range
How can i get the range of longitude and latitude?
Based on the comments from above you will need to do the following:
1) Use the Google Api maps reference for Android to determine the visible area on the map and if one of your points is within the determined area.
2) Carefully remove points added to the map but which are no longer needed. (IE the user has moved the map). Be careful at this point not to remove a point before the map has finished updating, as the user could tap on a point and crash the app.
3) Decide what you're doing about zoom level, if a user zooms right out then you need to do one of the following:
a) Display nothing, give the user feedback to zoom in for points.
b) Use an algorithm to plot a point at an average of a point.
c) Display a marker as with b but centered in a region with the number of points in that region.
I would advise lots of research on stack regarding previous questions as this topic has been covered in some detail.
For c) there has been a good iOS implementation which is now a for-sale library, however the name of the library escapes me at the moment. I am told the implementation is excellent.
I cannot express enough that you need to make sure your map operations are done asynchronously, be wary of this or fall into lots of traps.

Latitude & longitude coordinates of Australian states/territories for database using Google Maps

We have a database which has location-based search using Google Maps API. However searching by state or territory in Australia is problematic because Google Maps locates these at the centre of the states and most population centres in Australia are on the coast.
We need to hand code in the latitudes and longitudes so that when someone searches for the state 'NSW', for example, the database returns relevant results. Does anyone know where to find a list of the coordinates for the boundaries of Australian states & territories to code into the database?
This will save our busy programmer a lot of time.
Thanks in advance.
I'm the developer named - thought I should talk about what we finally did to implement this feature:
To clarify what this is actually used for, this database is for searching events which may have a geographical location.
At first I found this free map data: https://www.ga.gov.au/products/servlet/controller?event=GEOCAT_DETAILS&catno=60803.
However the data was difficult to work with and we decided to simply generate a basic outline of each of the states using Google Maps's My Maps feature (which RMW did).
I then created a pl/sql implementation of the PNPOLY function, and wrote the search code to run the PNPOLY function comparing the lat and lng of each event with the state outlines (exported from My Maps) and to only return events within the boundaries.
There were 2 main problems with this:
Towns/Cities on the border betwen 2 states were sometimes seen as being in the wrong state due to the low resolution of the state outlines.
Concern that the implementation was inefficient/inelegant (though no perf testing was done).
That implementation would probably have worked fine except for the first issue - towns were appearing in the wrong state.
The current implementation abandons the PNPOLY function in favour of a much simpler solution:
I added boolean columns to the events table - one for each state/territory in Australia.
when events are geocoded, we pull the state name out of the Google Maps API result and then compare it to a list of state names - if one matches we set the flag for that state to TRUE.
When searching, the state restriction simply becomes WHERE in_wa = TRUE (for searching events within Western Australia).
To migrate the existing events which didn't have the flags set, I didn't want to waste the PNPOLY code, and didn't want to hammer Google Maps with requests, so I wrote a migration to run the PNPOLY check over each event and set the correct flag for each event - this caused some current events to have the wrong state set because of the same issue above, but this won't affect future events.
You can see it in action at http://collectiveaction.com.au/events - choose from the state dropdown and click 'Update search results'.
You can download the Australian states boundaries to OpenStreetMap as an XML file. Just beware that the data license requires you to share derivative works.
I am sharing my gist: XML of state polygons. However, for some states, it comes with too many points and it could become a performance killer if you need to match a point with states for example. If you want to have a simple version, you can try using this tool to generate the polygon coordinates yourself.
Hope this help solving someone's pain.
Just an idea, can actually have an javascript array with the names of states and the related latlong that you want to centre the map?
So if someone look for NSW, then you load -33.833578,151.190872.
function initialize() {
var myLatlng = new google.maps.LatLng( -33.833578,151.190872);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
Let me know if that helps. Otherwise you can contact me as I'm in Adelaide :)
Cheers,
Ives

How to have markers on a map cluster instead of stack

my team is trying to resolve an issue with limited time. We have developed a fairly complex map interface on our site to display content (trips, social content, etc). when a user runs a search for "Kayaking San Francisco" for example, the map shows all the kayaking trips in SF, but since they are all geotagged (using geonames.org) to the same plan, the flags on the map stack instead of clustering. i am poking around trying to find a solution - do you have any ideas? we have RoR - http://www.ekoventure.com
Not completely sure if this hits your problem, but perhaps you could also check out the following article: Group features in Google Earth to hide detail when zoomed out
After checking the site you linked I'd say the problem is more likely in either your data or your search. When I search for "San Fransisco" I get a list of search hits that have nothing to do with SF (but eg. Las Vegas, Oregon, San Diego). Still the map only shows markers in downtown SF.
Is your data actually geocoded? Are you geocoding the search term (eg. using geonames) and then searching your data to get items that are within a certain radius from that location? Do you actually plot the found items on the map based on they own location, or based on the coordinate of the search?
You'll find a great overview of marker clustering options for gmaps at: http://www.svennerberg.com/2009/01/handling-large-amounts-of-markers-in-google-maps/