I want to access google maps app when I tap a button with lat / long in flutter app. I figured that google_maps_flutter plugin already have it out of the box, eg 1. I want to do the same using a custom button.
If you want to be able to open goold maps and other maps on users device, you can use map_launcher. Here is an example of how to use it:
import 'package:map_launcher/map_launcher.dart';
if (await MapLauncher.isMapAvailable(MapType.google)) {
await MapLauncher.launchMap(
mapType: MapType.google,
coords: coords,
title: title,
description: description,
);
}
Related
I have built an android application using ionic4. Previously I was using google maps API to show maps but due to some reasons, I have to shift to cordova native map plugin. I have done all the changes and everything is working fine in the browser but when I built an android app the custom marker is not showing instead the default red marker is shown on the map.
let markerOptions:MarkerOptions = {
position: position,
title: 'abc',
icon: {
url: 'assets/images/2.png',
size: {
width: 34,
height: 48
}
},
};
this.map.addMarker(markerOptions);
this is how I am adding markers to the map. On looking into this issue I found out that cordova android10 they have implemented a new way of giving the URL in marker options.
But I was not able to find how to mention that.
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
I'm building a map centric app and having a small issue .
I am displaying my map and getting current location . I can see the blue dot on the map and the directional arrow appears sometimes .
However i can't find any way to set the bearing . (or set the arrow to the direction the phone is pointing at)
Such as in google maps app , when you move the phone around - you can see the user position showing a directional fog towards where the phone is pointing .
I am using the compass plugin and getting the compass reading between 0-360 , however i'm not sure how to add that to my map + user location to make the arrow point in that direction.
Any ideas how to proceed ?
I'm developing named Xamarin.Forms.GoogleMaps which can set bearing like Google Maps API.
amay077/Xamarin.Forms.GoogleMaps: Map library for Xamarin.Forms using Google maps API
// No animation
await map.MoveCamera(CameraUpdateFactory.NewCameraPosition(
new CameraPosition(
new Position(35.7104, 139.8093), // center
17d, // zoom
45d, // bearing(rotation)
60d))); // tilt
// With animation
await map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(
new CameraPosition(
new Position(35.7104, 139.8093), // center
17d, // zoom
45d, // bearing(rotation)
60d)), // tilt
TimeSpan.FromSeconds(1));
I know I can add a Google map to an OpenLayers 2 map as an OpenLayers.Layer.Google(.v3) layer and can add the traffic layer to the included map using code like:
var map;
function init() {
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: google.maps.MapTypeId.TERRAIN}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
map.addLayers([gmap, gphy]);
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(gmap.mapObject);
map.setCenter(new OpenLayers.LonLat(-2, 50.9).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 10);
}
However our site uses a set of standard base maps and we would like to be able to display the traffic layer over these. Is this possible?
We would also be interested in being able to display Google weather and the Streetview overlay in a similar fashion.
Our site already uses Spherical Mercator projection so this is not an issue.
From the Google Maps Terms of service:
(h) No Use of Content without a Google Map. You must not use or
display the Content without a corresponding Google map, unless you are
explicitly permitted to do so in the Maps APIs Documentation. In any
event, you must not use or display the Content on or in conjunction
with a non-Google map. For example, you must not use geocodes obtained
through the Service in conjunction with a non-Google map. As another
example, you must not display Street View imagery alongside a
non-Google map, but you may display Street View imagery without a
corresponding Google map because the Maps APIs Documentation
explicitly permits you to do so.
In short, you can't use Google Maps content with a non-Google map, but you can use it without a map, depending on what the API documentation says.
I'm currently using the Google Maps v.3 API to generate a custom map of locations in my database on my site. Each location that turns up in the database query is given a marker and a simple Info Window that displays its name and address. However, I'd like to give users the option of also looking at the map on Google's site (maps.google.com) so that they can access driving directions there. Is there any way to do this? I was thinking something the along the lines of dynamically importing a GeoRSS feed, but I don't know if that's possible.
Users can click on the Google Logo on the bottom left hand side of the map to go to a standard google maps page.. alternatively can build up a URL from your map and send them off to a new page.. here's a function I use to give Users a URL that they can paste into other places.. you could use similar code with the window.open javascript function:
function GenerateLink(){
var url;
url = "http://maps.google.com/?ll=" + map.getCenter().lat() + "," + map.getCenter().lng() + '&z=' + map.getZoom();
prompt("You can copy this link using CTRL-C, its a direct link to Google Maps for the current map center and zoom level", url);
}
Duncan.