I have Navhost which contains photo fragment and map fragment.
Map fragment is working when I use it alone, but when I try to integrate it in parent fragment I can scroll map but I cannot use any marks and other my custom options.
I do not want to re-implement map functionality inside parent fragment as it should work out of the box.
All ideas are appreciated.
To be on the same page I would maybe rephrase my question. If I take official example how can I make several maps on the screen simultaneously inside wrapping fragment with correctly working touch events and ability to replace them and share data dynamically? (Official google maps example https://codelabs.developers.google.com/codelabs/maps-platform-101-android/#0 )
My mistake was simply using original SupportMapFragment while I had to use my own fragment which implements OnMapReadyCallback and inflates layout containing SupportMapFragment.
(Could not solve it for a week and solved right after posting a question.)
Related
I have a Google Map that I have embedded on my web site. I have managed to size and position the iFrame so that it sits where I want it to sit on my web page. I am using the new Google Maps version.
However, I want to be able to shift the centre of the map to the right, because as it standsnow, the box that displays the map layers is covering some of the locations I have marked.
I am not at this point using any Javascript or jQuery. I have simply taken the iFrame link provided by Google's embed feature and placed it in my HTML. I see there are other questions about map centering, but I can't parse them for my situation because they assume some Javascript implementation. Also, I'm hoping that I do not have to take on a whole API or Javascript library to solve this. Further, it is unclear to me if the other questions relate to the new Google Maps version, which is what I'm using.
Is there a way I can alter the centre of the embedded Google Map?
Just add a "center" parameter to your iframe url. Like so - center="40.714728,-73.998672". You can get the required coordinates by searching in google maps and picking them from the address.
You could alternatively also use a query parameter but center is more accurate.
refer - https://developers.google.com/maps/documentation/static-maps/intro#location
One of the requirements of Section 508 is that pages be readable without stylesheets:
ยง 1194.22 (d) Documents shall be organized so they are readable without requiring an associated style sheet.
We're currently facing a problem where Google Maps do not work without styles enabled (go figure). All the different pieces of the map just print out in order with no meaning. I've attached a sample image below.
Is there any easy way to deal with this? The only thing I can think of is to use JavaScript to test to see if CSS is disabled (a terrible thing to do, I know, I know) and then remove the map div and replace it with a static map that shows the same content. (If JavaScript is disabled too it's a moot point as the map won't even load.) Obviously the static map doesn't incorporate all the same functionality (zoom, pan, etc.), but it provides a readable page. So:
Is there another way to make Google Maps 508 compliant regarding styles disabled?
If not, how would one go about testing for CSS being disabled to do the fix described above?
Example map without styles:
The Standard you are pointing to is mainly for static content. Since a Google Map is highly scripted, you would call upon the Standards in 1194.21 - Software Applications, and have a <noscript> tag following the map saying something like "Google map showing . An accessible version is at ___."
Next when testing the Map, it most likely fail to be compliant, so you should request an equivalent facilitation exception for the map from the agency's Section 508 coordinator. This allows you to serve up a Google Map, but you provide an equivalent method of getting the information. If the static method that Albert pointed to is acceptable, a link to it should be placed in proximity to the Google one,
gmaps for business does not offer this option: https://developers.google.com/maps/documentation/business/accessibility
that link is to google maps for business, which i'm assuming you are not using, but its the only maps api link under the a11y policies: http://www.google.com/accessibility/policy/
there is google earth, but that's not what you want i don't think. this is sticky, and not best-practice, but you gotta do what you gotta do...since you can detect when css is off, i would run that function first on page load, if it is, serve up gmaps with a static image map fallback, if its not, only serve up the static map. i wrote a post about using static images as fallbacks, which you can use. NOTE: this doesn't include the entire functionality i just mentioned, just loading gmaps with static image fallback: http://bowdenweb.com/wp/2011/05/optimize-google-maps.html
I would like to know how to create effects / animations over Google Maps markers. Specifically, I would like to zoom-in/out or "fade" a marker after a given amount of time. Could it be possible with HTML5 ? Is there any jquery effect library for doing this?
(I could use a map tile server for creating map tile overlays and re-generate tile overlays every second, but I guess it is very processing-intensive...)
Thanks in advance
I haven't seen any library to do this, and there isn't functionality in the API to fade Markers per say.
Instead, what you can do is simulate markers by creating your own Custom Overlay that looks like a marker. A custom overlay usually contains a div, which you can easily control the opacity of using JavaScript / jQuery based on a class or id you assign during the custom overlay construction.
As an example, if you look at this page you can see the is a button used to toggle the visibility, you could just as easily change that JavaScript to control the opacity of something.
I am looking at doing something similar.
If you set the marker option 'optimized: false' for all markers, each will have its own element, you can then use jQuery to select all the markers on your map using something along the lines of $('#map_canvas img[src*="filename"]'), assuming that you're using custom images for the markers.
What this doesn't address is relating each element in the array returned to a specific marker.
I think that you could add the markers to the map one at a time, re-run the jquery selector, and compare the elements returned vs. the previous run, to see which element was new. I haven't tested this part (I have what I say in the first paragraph), as I'm working towards something slightly different.
You should then be able to adjust the opacity/size of the image directly.
This might get clunky for large numbers of markers.
Paragraph two above is stupid.
Add a marker to the map, making sure to set the optimized:false option. then
var freshlyAddedMarkerImage = $('#map_canvas img[src*="your_marker_icon"][class!="adjustMe"]');
The newly added marker won't have the class, so will be the only element selected. Before setting the className, you could set an ID, add the element to an array in the same index position as the corresponding marker object is held in another array, etc.
This should be a lot less clunky to implement than what I proposed previously. I'll try and come back with a working example soon.
I suppose if you knew that there were groups of markers that would share the same transform (zoom/fade), due to being the same age or whatever, then you could add all of them and only do the jQuery select at the end, before looping through the returned elements setting a class that would allow you to adjust them en-masse.
How do do i add them to my google map ? I've added the marker manager
<script src="http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js"></script>
And used the same syntax as in the documentation but they don't show up. The coordinates are correct . Can someone please dumb it down for me . Also does the zoom level have to be to a specific value for me to see them ?
For anyone else in trouble
http://code.google.com/apis/maps/documentation/javascript/examples/index.html
Andrei,
I found the Google Android MapView tutorial to be very helpful:
http://developer.android.com/guide/tutorials/views/hello-mapview.html
It covers creating a basic map application, as well as adding overlays to the MapView, and links to the directions for obtaining the necessary API key. Unfortunately (like a lot of Google's example code, apparently), there are a couple errors in the directions, but I was able to fix those fairly easily.
For example, the definition of your Overlay Class should be:
public class HelloItemizedOverlay extends ItemizedOverlay<OverlayItem>
Which not precisely what the directions say. Eclipse turns out to be very helpful in fixing the problems with this, though.
As to your question about zoom level, it has been my experience that all of your overlays will be displayed as long is your zoom level (or pan state) allows it. If you push them off the screen, they're not displayed, obviously, but not lost either.
R.
I'm using Symfony 1.2.9 and sfEasyGMapPlugin 3.0.0
I need to put two gmaps on one page.
I've made custom ma name and DIV's id for each map. But I still can't make it work. Only second map is shown. The first one is not created.
Does anybody knows how to make them work using sfEasyGMapPlugin?
One of the TODO items for sfEasyGMapPlugin is to "correct javascript files that suppose that the map's javascript object is called 'map'".
My guess is that, because of this problem, you can only refer to one map object per page. You could try finding where 'map' is hardcoded and replace it with $gMap. I haven't used the plugin myself, so I can't say for sure. I've only used the Google Maps API directly with Symfony. Hope that helps.