google maps : put markers all over visible section on Google map display - google-maps

I want to show limited numbers of markers(let's take 50 or so...) at all zoom level and in a manner that markers covers all entire Google map display.
So, If I am viewing whole world in map, it will show markers all over the world not to exceed a certain number, and the if I zoomed to USA it will only show previous number of markers only inside USA.
And then again if I moved to Canada , then the map should show markers of Canada only.
I am not able to
- put makers on visible region over the map on limited distances
i.e. all the visible markers maintaining somewhat some distance from each other.

You might want to look into 'clustering' or 'bunching' the points into one. It doesn't do exactly what you are describing, but it will effectively limit the number of markers you have when you are zoomed out, and 'uncluster' them once you zoom in.
There are quite a few ways (all third party - the Google API doesn't support it yet), you could have a look here at one called ClusterMarker: http://googlemapsapi.martinpearman.co.uk/articles.php?cat_id=1.

You should use a marker manager!
See http://code.google.com/p/gmaps-utility-library-dev/ and http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/

Related

Google Maps Static API - Custom zoom with markers

I am creating an application that downloads images from maps using the Google Maps Static API. I would want to decide the zoom level when having markers on the map (right now the zoom is set automatically so that all markers are shown in the image). Does anyone know if this is possible?
Right now the zoom is set automatically so that all markers are shown in the image
You are halfway there. Once done, get the resulting the zoom level: map.getZoom();
However, I think your app violates Google's terms as it is forbidden to copy their content.
According to the documentation, you can use the center and zoom parameters to configure the map (they aren't required with markers):
Location Parameters
center (required if markers not present) defines the center of the map, equidistant from all edges of the map. This parameter takes a location as either a comma-separated {latitude,longitude} pair (e.g. "40.714728,-73.998672") or a string address (e.g. "city hall, new york, ny") identifying a unique location on the face of the earth. For more information, see Locations below.
zoom (required if markers not present) defines the zoom level of the map, which determines the magnification level of the map. This parameter takes a numerical value corresponding to the zoom level of the region desired. For more information, see zoom levels below.
example URL:
https://maps.googleapis.com/maps/api/staticmap?center=42,-72&zoom=5&size=400x400&markers=color:blue%7Clabel:S%7C11211%7C11206%7C11222&format=jpg
resulting image:

API to display the nearest photos to a long/lat location from Google Maps Views (like Panoramio)

Forgive me if this has already been asked but searching on 'Google Maps Views' brings up rather a lot of irrelevant hits.
Is there an API to display the nearest (say) 5 photos to a particular long/lat location from the photos available on Google Maps Views? I don't particularly need them on a map, just to embed thumbnails of the photos and link to the originals.
eg I have a page for Callanish stone circle. Could I embed images from Views based on a long/lat query?
Here's what is on Views for that location:
https://www.google.com/maps/views/explore?hl=en&gl=gb&vm=1&ll=54.596562,-3.104517&bd=54.586641,-3.121855,54.606481,-3.087179&z=15&pv=2
I read that Views is what is supposed to be taking over from Panoramio. I know Panoramio had an API but that's being shut down.
If this is possible, does anyone have an example of something similar? Showing photos on a map would be OK if that's the only way to do it.
Many thanks
Andy
http://www.megalithic.co.uk/article.php?sid=42
The Google Maps API can do it and the imagery carousel at the bottom of Google Maps website is a good example of it.
Nearest photos
You can retrieve the nearest photos to a location using the Places Photo feature, which is part of the Places library. As you want multiple photos, you need to use Place Details requests - function getDetails(). It will return up to ten PlacePhoto objects.
You probably want to submit a small height/width since you create thumbnails. And send another request with a larger height/width when a thumbnail is clicked.
Nearest Street View panorama
If, by chance, a road close to Callanish stone circle has been photographed by Street View, you can add this imagery as well.
Requests for Street View panoramas include a radius parameter. The callback function returns the nearest imagery within the requested radius. See this example. Thereby, you can retrieve one panorama by passing a very large radius.

Maps API - Disable parts of the map

I am doing some research for what Map API to use for a coming project.
The main requirement is the ability to lock a map, and the ability to disable parts of the map.
Think about a special purpose map for Europe where I would like to disable and gray out the non-european countries.
A click on those grayed out areas should do nothing, meaning for all of the world except for Europe.
So, is it possible to disable large portions of the map?
Is it possible to add layers for the borders for each country, that is clickable, for instance on Germany?
I am looking at Bing or Google Maps at this point. Which one is more developer friendly one?
Bing looks so much nicer with the birds eye, much easier to read out the map and know what you are looking at. I find Googles full of clutter and always have problem knowing what I am looking at.
Possible approach(google-Maps): use a Polygon with multiple paths.
1 path for the entire world(vertices defined in clockwise order)
other paths for the enabled area(vertices defined in opposite clockwise order)
The result will be a polygon that covers the entire world with a hole for the enabled area. The map will not respond to click-events outside the enabled area(because it's covered by the polygon). The map will still respond to dblclick and zoom in, but this may be avoided by cancelling the propagation of the dblclick-event of the polygon.
It wouldn't be possible to gray out the dissabled area, but you could use the fillColor of the polygon to signalize which part of the map is disabled.

Adding the marker to Google Maps external link

I have website that uses Google maps to plot the location of registered businesses. This uses javascript and shows the orange marker to pinpoint the exact location. I'm trying to build a link to the actual google maps page and my code is doing what I want it to except the marker doesn't show up. Is there another peice of code I can add to this to make it show up?
Full Sized Map
To add a pin you need the q parameter. It holds q=latitude+longitude+(url-encoded-text)
Here is an example of hybrid map with weather - pin at Embassy Suites, map centered on Horseshoe Falls
https://maps.google.com/maps?hl=en&ll=43.076,-79.074&spn=0.0212,0.0496&t=h&z=16&q=43.0795N+79.0818W+(Nice%20Hotel)&lci=weather
hl= two letter language code
ll= the map center using coma
separated +/- values
spn= the viewport span in degrees, works with
the z parameter
t= map type {m|k|h|p}
z= is the zoom factor
q= latitude+longitude+(url-encoded-text), the lat/lon in q have to be
followed by a letter - N/S or E/W instead of using +/-
lci= special codes, coma separated - i know of weather, transit_comp, com.panoramio.all
layer= additional layers, e.g. t for traffic
Google is changing things with the new Google Maps and a lot of functionality has been removed/replaced. You can check the new Maps Engine here http://mapsengine.google.com/map/

Display Leaflet map per country

I'm developing a mobile application on phonegap.
For the Geolocation I'm using Leaflet "a JavaScript library for mobile-friendly maps"
and I just want to know if it is possible to display the map per country without having access to the others. So the user can just navigate in his country.
Leaflet allows you to set limits on zooming and panning.
One solution would be to just limit the viewable area of the map to the coordinates needed for certain countries.
I am quite sure that there is geodata available out there giving you the highest/lowest latitude and longitude values per country (sort of a bounding box around a countries borders), so you could just limit the viewable area to those values.
To limit the viewable area use
Map.maxBounds(..LatLngBounds..)
More here http://leafletjs.com/reference.html
According to this bug in the GitHub issue tracker for Leaflet, it seems that this is not possible at the moment.