All Projects → mapsplugin → Cordova Plugin Googlemaps

mapsplugin / Cordova Plugin Googlemaps

Licence: apache-2.0
Google Maps plugin for Cordova

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
objective c
16641 projects - #2 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Cordova Plugin Googlemaps

Involt
Inject hardware interactions directly into HTML layout.
Stars: ✭ 128 (-92.23%)
Mutual labels:  phonegap, cordova
Cordova Plugin Getuisdk
个推官方提供的推送SDK PhoneGap(Cordova) 插件(支持 Android & iOS)
Stars: ✭ 65 (-96.05%)
Mutual labels:  phonegap, cordova
Cordova Plugin Linkedin
Cordova plugin for LinkedIn
Stars: ✭ 17 (-98.97%)
Mutual labels:  phonegap, cordova
Hiapp
A simple and interesting hybrid app. React Native version: http://t.cn/R5LqqLz Demo:
Stars: ✭ 791 (-51.97%)
Mutual labels:  phonegap, cordova
Android Consent Sdk
Configurable consent SDK for Android
Stars: ✭ 80 (-95.14%)
Mutual labels:  google, sdk
Sketch Map Generator
Sketch plugin to fill a shape with a map generated from a given location using Google Maps and Mapbox
Stars: ✭ 824 (-49.97%)
Mutual labels:  google, google-maps
Cordova Plugin Tensorflow
On-device image recognition via TensorFlow/Inception. For Cordova/PhoneGap.
Stars: ✭ 51 (-96.9%)
Mutual labels:  phonegap, cordova
Cordova Plugin Googleplus
➕ Cordova plugin to login with Google Sign-In on iOS and Android
Stars: ✭ 537 (-67.4%)
Mutual labels:  phonegap, cordova
Framework7 Cli
Framework7 command line utility
Stars: ✭ 76 (-95.39%)
Mutual labels:  phonegap, cordova
Countly Sdk Cordova
Countly Product Analytics SDK for Cordova, Icenium and Phonegap
Stars: ✭ 69 (-95.81%)
Mutual labels:  sdk, phonegap
Cordova Admob Pro
🔥 Cordova Plugin for Google AdMob, DFP, ADX. Easy monetization using mobile Ad, with single line of JavaScript. Compatible with Cordova CLI, Inoic, PhoneGap Build, etc.
Stars: ✭ 690 (-58.11%)
Mutual labels:  phonegap, cordova
Intercom Cordova
Cordova/PhoneGap plugin for Intercom
Stars: ✭ 88 (-94.66%)
Mutual labels:  phonegap, cordova
Cordova Template Framework7 Vue Webpack
Framework7 - Vue - Webpack Cordova Template with Webpack Dev Server and Hot Module Replacement
Stars: ✭ 630 (-61.75%)
Mutual labels:  phonegap, cordova
Placepicker
Free Android Map Place Picker alternative using Geocoder instead of Google APIs
Stars: ✭ 126 (-92.35%)
Mutual labels:  google, google-maps
Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (-62.84%)
Mutual labels:  google, google-maps
Blinkid Cordova
ID scanning for cross-platform apps built with Cordova and Phonegap.
Stars: ✭ 44 (-97.33%)
Mutual labels:  phonegap, cordova
Corber
CLI for building hybrid apps with Ember/Vue/Glimmer/Cordova
Stars: ✭ 327 (-80.15%)
Mutual labels:  phonegap, cordova
Toast Phonegap Plugin
🍻 A Toast popup plugin for your fancy Cordova app
Stars: ✭ 503 (-69.46%)
Mutual labels:  phonegap, cordova
Cordovue
A sample Apache Cordova application using VueJS.
Stars: ✭ 66 (-95.99%)
Mutual labels:  phonegap, cordova
Framework7 Template Vue Simple
Deprecated! Simple Framework7 Vue starter app template in a single HTML file
Stars: ✭ 81 (-95.08%)
Mutual labels:  phonegap, cordova

Cordova GoogleMaps plugin for Android, iOS and Browser v2.7.1

Download Build test (multiple_maps branch)

This plugin displays Google Maps in your application. This plugin uses these libraries for each platforms:

Both PhoneGap and Apache Cordova are supported.

Android, iOS

Browser


Guides

Quick install

$> cordova plugin add cordova-plugin-googlemaps

Then set your Google Maps API keys into your config.xml (Android / iOS).

<widget ...>
  <preference name="GOOGLE_MAPS_ANDROID_API_KEY" value="(api key)" />
  <preference name="GOOGLE_MAPS_IOS_API_KEY" value="(api key)" />
</widget>

For browser platform,

// If your app runs this program on browser,
// you need to set `API_KEY_FOR_BROWSER_RELEASE` and `API_KEY_FOR_BROWSER_DEBUG`
// before `plugin.google.maps.Map.getMap()`
//
//   API_KEY_FOR_BROWSER_RELEASE for `https:` protocol
//   API_KEY_FOR_BROWSER_DEBUG for `http:` protocol
//
plugin.google.maps.environment.setEnv({
  'API_KEY_FOR_BROWSER_RELEASE': '(YOUR_API_KEY_IS_HERE)',
  'API_KEY_FOR_BROWSER_DEBUG': ''  // optional
});

// Create a Google Maps native view under the map_canvas div.
var map = plugin.google.maps.Map.getMap(div);

PhoneGap Build settings

<widget ...>

  <!--
    You need to specify cli-7.1.0 or greater version.
    https://build.phonegap.com/current-support
  -->
  <preference name="phonegap-version" value="cli-8.1.1" />
</widget>

Install optional variables (config.xml)

  • GOOGLE_MAPS_PLAY_SERVICES_VERSION = (16.0.1)
    The Google Play Services SDK version. You need to specify the same version number with all other plugins. Check out the latest version here.

  • ANDROID_SUPPORT_V4_VERSION = (27.1.1)
    This plugin requires the Android support library v4. The minimum version is 24.1.0. Check out the latest version here.

  • LOCATION_WHEN_IN_USE_DESCRIPTION
    This message is displayed when your application requests LOCATION PERMISSION for only necessary times.

  • LOCATION_ALWAYS_USAGE_DESCRIPTION
    This message is displayed when your application requests LOCATION PERMISSION for always.


Please support this plugin activity.

In order to keep this plugin as free, please consider to donate little amount for this project.

Donate


Release Notes

  • v2.7.1

    • Fix: (iOS) UiWebView references present in v2.7.0
  • v2.7.0

    • Re-adoption: cordova-plugin-googlemaps-sdk dependency
    • Important update: No longer support UIWebView on iOS. WKWebView only.
    • Fix: (iOS) Can't load image files from local host on ionic 4 / 5
    • Update: (Android) prevent null pointer error in AsyncLoadImage.java
    • Fix: Css animation interference when call setDiv and there is a push/pop page
    • Fix: (Android/iOS/Browser) KML parser crash
    • Fix: flickering and wrong rendering of some DOM elements
    • Add: map.stopAnimation()
    • Fix: can't remove map while map.animateCamera() is running
    • Update: (Android) Increase cache memory size
    • Update: (Android/iOS) Danish localization
    • Fix: (Android) Prevent resize event after map.setDiv(null)
    • Fix: (Android/iOS) Can not interactive with the map inside
    • Fix: jslint errors
    • Fix: marker.setIcon crashes
    • Update: Set default value range to heading and tilt
    • Fix: (Android/iOS) touch detection is wrong after clicking on back button very soon.
    • Fix: An error occurs when you click a marker of marker cluster #2660
    • Remove promise-7.0.4-min.js.map
    • Fix: (iOS) bug fix: App crashes if "bearing" property is ""
    • Fix: HTMLColor2RGBA() converts to incorrect value
    • Fix: (Android) Can't load marker image from the Internet
    • many bug fixes...

Demos

Demo (Browser)


Documentation

All documentations are here!!

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

Quick examples


Map
var options = {
  camera: {
    target: {lat: ..., lng: ...},
    zoom: 19
  }
};
var map = plugin.google.maps.Map.getMap(mapDiv, options)

Marker
var marker = map.addMarker({
  position: {lat: ..., lng: ...},
  title: "Hello Cordova Google Maps for iOS and Android",
  snippet: "This plugin is awesome!"
})

MarkerCluster
var markerCluster = map.addMarkerCluster({
  //maxZoomLevel: 5,
  boundsDraw: true,
  markers: dummyData(),
  icons: [
      {min: 2, max: 100, url: "./img/blue.png", anchor: {x: 16, y: 16}},
      {min: 100, max: 1000, url: "./img/yellow.png", anchor: {x: 16, y: 16}},
      {min: 1000, max: 2000, url: "./img/purple.png", anchor: {x: 24, y: 24}},
      {min: 2000, url: "./img/red.png",anchor: {x: 32,y: 32}}
  ]
});

HtmlInfoWindow
var html = "<img src='./House-icon.png' width='64' height='64' >" +
           "<br>" +
           "This is an example";
htmlInfoWindow.setContent(html);
htmlInfoWindow.open(marker);

Circle
var circle = map.addCircle({
  'center': {lat: ..., lng: ...},
  'radius': 300,
  'strokeColor' : '#AA00FF',
  'strokeWidth': 5,
  'fillColor' : '#880000'
});

Polyline
var polyline = map.addPolyline({
  points: AIR_PORTS,
  'color' : '#AA00FF',
  'width': 10,
  'geodesic': true
});

Polygon
var polygon = map.addPolygon({
  'points': GORYOKAKU_POINTS,
  'strokeColor' : '#AA00FF',
  'strokeWidth': 5,
  'fillColor' : '#880000'
});

GroundOverlay
var groundOverlay = map.addGroundOverlay({
  'url': "./newark_nj_1922.jpg",
  'bounds': [
    {"lat": 40.712216, "lng": -74.22655},
    {"lat": 40.773941, "lng": -74.12544}
  ],
  'opacity': 0.5
});

TileOverlay
var tileOverlay = map.addTileOverlay({
  debug: true,
  opacity: 0.75,
  getTile: function(x, y, zoom) {
    return "../images/map-for-free/" + zoom + "_" + x + "-" + y + ".gif"
  }
});

KmlOverlay
map.addKmlOverlay({
  'url': 'polygon.kml'
}, function(kmlOverlay) { ... });

Geocoder
plugin.google.maps.Geocoder.geocode({
  // US Capital cities
  "address": [
    "Montgomery, AL, USA", ... "Cheyenne, Wyoming, USA"
  ]
}, function(mvcArray) { ... });

poly utility
var GORYOKAKU_POINTS = [
  {lat: 41.79883, lng: 140.75675},
  ...
  {lat: 41.79883, lng: 140.75673}
]
var contain = plugin.google.maps.geometry.poly.containsLocation(
                    position, GORYOKAKU_POINTS);
marker.setIcon(contain ? "blue" : "red");

encode utility
var GORYOKAKU_POINTS = [
  {lat: 41.79883, lng: 140.75675},
  ...
  {lat: 41.79883, lng: 140.75673}
]
var encodedPath = plugin.google.maps.geometry.
                       encoding.encodePath(GORYOKAKU_POINTS);

spherical utility
var heading = plugin.google.maps.geometry.spherical.computeHeading(
                        markerA.getPosition(), markerB.getPosition());
label.innerText = "heading : " + heading.toFixed(0) + "°";

Location service
plugin.google.maps.LocationService.getMyLocation(function(result) {
  alert(["Your current location:\n",
      "latitude:" + location.latLng.lat.toFixed(3),
      "longitude:" + location.latLng.lng.toFixed(3),
      "speed:" + location.speed,
      "time:" + location.time,
      "bearing:" + location.bearing].join("\n"));
});

StreetView
var div = document.getElementById("pano_canvas1");
var panorama = plugin.google.maps.StreetView.getPanorama(div, {
  camera: {
    target: {lat: 42.345573, lng: -71.098326}
  }
});

What is the difference between this plugin and Google Maps JavaScript API v3?

Google Maps JavaScript API v3 works on any platforms, but it does not work if device is offline.

This plugin uses three different APIs:

In Android and iOS applications, this plugin displays native Google Maps views, which is faster than Google Maps JavaScript API v3. And it even works if the device is offline.

In Browser platform, this plugin displays JS map views (Google Maps JavaScript API v3). It should work as PWA (progressive web application), but the device has to be online.

In order to work for all platforms, this plugin provides own API instead of each original APIs. You can write your code similar to the Google Maps JavaScript API v3.

Feature comparison table

Google Maps JavaScript API v3 Cordova-Plugin-GoogleMaps(Android,iOS) Cordova-Plugin-GoogleMaps(Browser)
Rendering system JavaScript + HTML JavaScript + Native API's JavaScript
Offline map Not possible Possible (only your displayed area) Not possible
3D View Not possible Possible Not possible
Platform All browsers Android and iOS applications only All browsers
Tile image Bitmap Vector Bitmap

Class comparison table

Google Maps JavaScript API v3 Cordova-Plugin-GoogleMaps
google.maps.Map Map
google.maps.Marker Marker
google.maps.InfoWindow Default InfoWindow, and HtmlInfoWindow
google.maps.Circle Circle
google.maps.Rectangle Polygon
google.maps.Polyline Polyline
google.maps.Polygon Polygon
google.maps.GroundOverlay GroundOverlay
google.maps.ImageMapType TileOverlay
google.maps.MVCObject BaseClass
google.maps.MVCArray BaseArrayClass
google.maps.Geocoder plugin.google.maps.geocoder
google.maps.geometry.spherical plugin.google.maps.geometry.spherical
google.maps.geometry.encoding plugin.google.maps.geometry.encoding
google.maps.geometry.poly plugin.google.maps.geometry.poly
(not available) MarkerCluster
google.maps.KmlLayer KmlOverlay
(not available) LocationService
google.maps.StreetView StreetView
google.maps.Data (not available)
google.maps.DirectionsService (not available)
google.maps.DistanceMatrixService (not available)
google.maps.TransitLayer (not available)
google.maps.places.* (not available)
google.maps.visualization.* (not available)

How does this plugin work (Android, iOS)?

This plugin generates native map views, and puts them under the browser.

The map views are not HTML elements. This means that they are not a <div> or anything HTML related. But you can specify the size and position of the map view using its containing <div>.

This plugin changes the background to transparent in your application. Then the plugin detects your touch position, which is either meant for the native map or an html element (which can be on top of your map, or anywhere else on the screen).

The benefit of this plugin is the ability to automatically detect which HTML elements are over the map or not.

For instance, in the image below, say you tap on the header div (which is over the map view). The plugin will detect whether your tap is for the header div or for the map view and then pass the touch event appropriately.

This means you can use the native Google Maps views similar to HTML elements.


Official Communities

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].