Ionic中判断标记是否在多边形内及cordova-plugin-googlemaps使用咨询
Great question—let’s unpack this step by step:
Can you perform calculations like this using the native
cordova-plugin-googlemaps?
Absolutely! This plugin wraps the native Google Maps SDKs (for Android and iOS), which include built-in utilities for common spatial calculations. You don’t need to rely on external code snippets for most use cases. For example, to calculate the distance between two coordinates, you can use the plugin’s geometry utilities directly:const pointA = new plugin.google.maps.LatLng(37.7749, -122.4194); const pointB = new plugin.google.maps.LatLng(34.0522, -118.2437); const distanceInMeters = plugin.google.maps.geometry.spherical.computeDistanceBetween(pointA, pointB);Most common calculations (distance, area, heading, etc.) are all available through the plugin’s exposed APIs.
Do you need to import the Google Maps JavaScript script?
No, you don’t. Thecordova-plugin-googlemapsis entirely based on native mobile SDKs, not the web-based Google Maps JavaScript API. You won’t need to include any web-side Google Maps JS scripts in your Cordova project—all interactions happen through the plugin’s native bridge.Do Google Maps features work with the native plugin?
Most core Google Maps features that are available in the native mobile SDKs are supported by the plugin. That includes all the calculation tools, map markers, polygons, routing, and layer controls you’d expect. The main caveat is that web-specific features (like DOM-based overlays or web-only JS API methods) won’t translate directly, but any functionality that’s part of the native Android/iOS Google Maps SDKs can be accessed via the plugin’s APIs.
内容的提问来源于stack exchange,提问作者yavg

