Is there any way how make normal Map View in flutter. I need to have map ready when user opens the app. Only thing I saw, is that apptree plugin, but I could only make the map appear after user taps the button (and fullscreen, I need to put it into container). Basicaly what I need is some Map Widget, is there any ?
You can use some plugin like
https://github.com/apptreesoftware/flutter_google_map_view
flutter plugin for displaying google maps on iOS and Android
//Create an instance variable for the mapView
var _mapView = new MapView();
//Add a method to call to show the map.
void showMap() {
_mapView.show(new MapOptions(showUserLocation: true));
}
Unfortunately this is one of the drawbacks of choosing to render own components on GPU instead of using OEM solutions, they need to bake GMaps renderer over Flutter APIs and probably will, in the meanwhile, try this implementation: https://github.com/apptreesoftware/flutter_map
Related
I need to just show the map on my physical device without any functionality, but each map library needs an API key or something like that, maybe someone knows any use cases for any map library for simplicity? thx!
You need an API key if you want to use the map services.
Alternatively, if you just want to point to a given pleace and display a map showing that place:
Go to the map website with your browser (make sure to have the place you want in the middle of screen)
Grab the address (url) from the browser
In React Native, use an instance of a Webview targeting the URL just copied.
The Webview inside your app will render the map as your browser does.
I'm using Google Maps SDK to show a map on my site. In addition, I'm showing some custom pins using tiles overlays -> https://developers.google.com/maps/documentation/android-sdk/tileoverlay .
I'm inserting an overlay like this:
const tileAdaptor = new SomeAdaptor();
map.overlayMapTypes.insertAt(0, tileAdaptor);
And now, from other part of my code, I want to access that same instance. I was doing it like this:
window.map.overlayMapTypes.je[0];
But, surprisingly, the .je attribute has been renamed! I do not know if that's because it's an internal API or something like that. Now it has been renamed to .td.
So, my question is, is there a way to get that first overlay without using internal APIs?
Don't use undocumented properties, they can (and will) change with any new release of the API.
You need the overlayMapTypes property, which is a MVCArray, which has a getArray method
window.map.overlayMapTypes.getArray[0]
I'm using Google Maps SDK for my Xamarin.iOS app and i got an problem.
I want to put MapView into specific UIView(that was created on Storyboard) and that is no so easy as expected.
At current moment i have tried to put MapView class into my UIView class(in native iOS Development its an solution),but it didn't worked.
Also i have tried to do something like this:
//init google SDK stuff
MyViewWhereIWantToPutGoogleMaps.AddSubview(MapView); // and the same,no effect
Any ideas? Thanks.
Remember you need to indicate the CGRect for the MapView object.
If you want it to cover the whole space in MyViewWhereIWantToPutGoogleMaps you just do:
var frame = MyViewWhereIWantToPutGoogleMaps.Frame;
var googleMaps = new Google.Maps.MapView (new CoreGraphics.CGRect(0, 0, frame.Width, frame.Height));
MyViewWhereIWantToPutGoogleMaps.AddSubview (googleMaps);
Hope this helps.-
I'm looking for a way to use a custom UIView (not just a custom image) instead of default marker provided by Google Maps iOS SDK. Basically I need a possibility to place my UIView agains proper coordinates of the map, so not necessarily to use markers as they are, just any suitable solution. Any ideas?
There is not currently a way to do this. You can view the relevent feature request (and star it, to show interest) here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5203
The marker only shows an image. So it cannot take a CustomView. Moreover, if your custom view has some sort of button on it there is no way you can track the events from those button.
In simple words the map renders the markers as UIImage.
Can you advise if storyboards are supported with google maps ios sdk v 1.1. I'm getting some strange results
I have to 2 view controllers for maps. The first one displays a single map and renders absolutely fine as it pushed onto the navigationcontroller using storyboard push segue..
I have another map viewcontroller which is loading multiple markers. This view controller is also on the storyboard but loaded using a custom transition to fade in.
I am loading the views as per the sdk examples in the loadView method.
I have 3 problems with it
1.The first time the map with multiple markers is loaded the map does not get displayed/rendered. When i tap the button to display the view again (which does nothing if the view is loaded) it then renders the map and markers.
2.I close this view and load another view using the custom segue. if i go back to the map view with multiple markers i get an exception in the loadview method when it tries to assign the mapview to the view
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <GMSVectorMapViewBridge: 0x150376a0; frame = (0 0; 320 416); layer = <CALayer: 0x15055cd0>> is associated with <GMMapResultsViewController: 0x10faa2a0>. Clear this association before associating this view with <GMMapResultsViewController: 0xb51ad90>.
3.Lastly if i load the first map view controller with asingle marker, it loads fine, then I return to the 2nd map view controller with multiple markers. The same problem occurs when rendering the map. then if i try to select a map marker it is not handled by the delegate. Even though it would work ok if i loaded this map the first time.
I suspect if you do the following, your problem may go away...
add a UIView into the view controller where you're working
set it's type to be GMSMapView in the identity inspector.
Then control-drag it to your code as you would for any other outlet.
Once you've done this working with the Google maps becomes quite easy.
In case anyone needs a working example: Google Maps SDK 1.1.2 with Storyboards. You can find it on github: https://github.com/rendulic/GMaps3D