Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/google-map-utils #298

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d98a2a
feat(google-map-utils): Init
herefishyfish Jul 5, 2022
424d5d0
chore(google-maps-utils): ReadMe
herefishyfish Jul 5, 2022
f6cd792
feat(google-maps-utils): iOS init
herefishyfish Jul 6, 2022
8f3a61f
feat(google-maps-utils): iOS GeoJson wip
herefishyfish Jul 6, 2022
48f174b
feat(google-maps-utils): iOS GeoJson
herefishyfish Jul 6, 2022
c1c68de
feat(google-maps-utils): Android GeoJson Styles
herefishyfish Jul 6, 2022
4cf8289
feat(google-maps-utils): Android map clustering
herefishyfish Jul 9, 2022
08ec261
fix(google-maps-utils): Android heatmap provider
herefishyfish Jul 9, 2022
755958c
feat(google-maps-utils): ios heatmap wip
herefishyfish Jul 10, 2022
3afbca1
feat(google-maps-utils): iOS Heatmap Tiles
herefishyfish Jul 11, 2022
8b62441
feat(google-maps-utils): iOS clustering
herefishyfish Jul 11, 2022
b635450
feat(google-maps-utils): demo marker info
herefishyfish Jul 11, 2022
8b74920
Merge branch 'NativeScript:main' into feat/google-map-utils
herefishyfish Jul 14, 2022
0413bac
Fix/google maps ground overlay (#303)
tommag21 Jul 15, 2022
47c5e9f
Merge branch 'NativeScript:main' into feat/google-map-utils
herefishyfish Jul 16, 2022
860f3c3
feat(google-maps-utils):android clustermarker opts
herefishyfish Jul 16, 2022
08b7f6a
feat(google-maps-utils): match cluster styles
herefishyfish Jul 16, 2022
34e85fd
feat(google-maps-utils): Readme
herefishyfish Jul 16, 2022
94c63c5
cleanup wip
herefishyfish Jul 21, 2022
a7f29ad
fix: remove wip functionality from demo
herefishyfish Jul 21, 2022
1aa9756
fix: android heatmap gradient
herefishyfish Jul 21, 2022
3bf7f5e
Merge branch 'main' into feat/google-map-utils
NathanWalker Aug 8, 2022
f9ffcfa
fix: remove console log
herefishyfish Aug 8, 2022
0f9209c
Merge branch 'main' into feat/google-map-utils
NathanWalker Sep 23, 2022
6c1c567
Merge branch 'NativeScript:main' into feat/google-map-utils
herefishyfish Oct 7, 2022
5959139
fix(gmaps-utils): refactor to align more with gmap
herefishyfish Nov 12, 2022
83ef5da
fix(gmap-utils): ios refactor
herefishyfish Nov 12, 2022
d1f4b2e
chore(google-map-utils): rename member functions
herefishyfish Dec 1, 2022
064ad74
Merge branch 'NativeScript:main' into feat/google-map-utils
herefishyfish Dec 6, 2022
b14f552
feat(google-map-utils): use mixin
herefishyfish Dec 16, 2022
87ce260
Merge branch 'feat/google-map-utils' of https://github.com/herefishyf…
herefishyfish Dec 16, 2022
0922e78
fix(google-map-utils): mixin
herefishyfish Dec 16, 2022
1d91771
fix(google-map-utils): ios geojson
herefishyfish Dec 16, 2022
51a871b
fix(google-map-utils): remove logging
herefishyfish Dec 16, 2022
eb87b86
Merge branch 'main' into feat/google-map-utils
herefishyfish May 19, 2023
0972ed0
chore: update android
herefishyfish May 19, 2023
050136b
Merge branch 'main' into feat/google-map-utils
herefishyfish May 19, 2023
0904788
Merge branch 'main' into feat/google-map-utils
herefishyfish Jul 7, 2023
6da8e45
Merge branch 'main' into feat/google-map-utils
herefishyfish Aug 9, 2023
cb9c7bf
chore: update cluster item
herefishyfish Jan 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [@nativescript/fingerprint-auth](packages/fingerprint-auth/README.md)
- [@nativescript/geolocation](packages/geolocation/README.md)
- [@nativescript/google-maps](packages/google-maps/README.md)
- [@nativescript/google-maps-utils](packages/google-maps-utils/README.md)
- [@nativescript/google-signin](packages/google-signin/README.md)
- [@nativescript/haptics](packages/haptics/README.md)
- [@nativescript/imagepicker](packages/imagepicker/README.md)
Expand Down
4 changes: 3 additions & 1 deletion apps/demo-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"main": "./src/main.ts",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
"@nativescript/google-maps": "file:../../dist/packages/google-maps",
"@nativescript/google-maps-utils": "file:../../dist/packages/google-maps-utils",
"@nativescript/jetpack-compose": "file:../../dist/packages/jetpack-compose",
"@nativescript/animated-circle": "file:../../dist/packages/animated-circle",
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
"@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in",
Expand All @@ -20,7 +23,6 @@
"@nativescript/facebook": "file:../../dist/packages/facebook",
"@nativescript/fingerprint-auth": "file:../../dist/packages/fingerprint-auth",
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
"@nativescript/google-maps": "file:../../dist/packages/google-maps",
"@nativescript/google-signin": "file:../../dist/packages/google-signin",
"@nativescript/haptics": "file:../../dist/packages/haptics",
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
Expand Down
1 change: 1 addition & 0 deletions apps/demo-angular/src/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const routes: Routes = [
{ path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then((m) => m.FingerprintAuthModule) },
{ path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then((m) => m.GeolocationModule) },
{ path: 'google-maps', loadChildren: () => import('./plugin-demos/google-maps.module').then((m) => m.GoogleMapsModule) },
{ path: 'google-maps-utils', loadChildren: () => import('./plugin-demos/google-maps-utils.module').then((m) => m.GoogleMapsUtilsModule) },
{ path: 'google-signin', loadChildren: () => import('./plugin-demos/google-signin.module').then((m) => m.GoogleSigninModule) },
{ path: 'haptics', loadChildren: () => import('./plugin-demos/haptics.module').then((m) => m.HapticsModule) },
{ path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then((m) => m.ImagepickerModule) },
Expand Down
3 changes: 3 additions & 0 deletions apps/demo-angular/src/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export class HomeComponent {
{
name: 'google-maps',
},
{
name: 'google-maps-utils',
},
{
name: 'google-signin',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ActionBar title="google-maps-utils" class="action-bar"> </ActionBar>
<StackLayout class="p-20">
<ScrollView class="h-full">
<StackLayout>
<Button text="Test google-maps-utils" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
</StackLayout>
</ScrollView>
</StackLayout>
19 changes: 19 additions & 0 deletions apps/demo-angular/src/plugin-demos/google-maps-utils.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, NgZone } from '@angular/core';
import { DemoSharedGoogleMapsUtils } from '@demo/shared';
import { } from '@nativescript/google-maps-utils';

@Component({
selector: 'demo-google-maps-utils',
templateUrl: 'google-maps-utils.component.html',
})
export class GoogleMapsUtilsComponent {

demoShared: DemoSharedGoogleMapsUtils;

constructor(private _ngZone: NgZone) {}

ngOnInit() {
this.demoShared = new DemoSharedGoogleMapsUtils();
}

}
10 changes: 10 additions & 0 deletions apps/demo-angular/src/plugin-demos/google-maps-utils.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
import { GoogleMapsUtilsComponent } from './google-maps-utils.component';

@NgModule({
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: GoogleMapsUtilsComponent }])],
declarations: [GoogleMapsUtilsComponent],
schemas: [ NO_ERRORS_SCHEMA]
})
export class GoogleMapsUtilsModule {}
4 changes: 3 additions & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"repository": "<fill-your-repository-here>",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
"@nativescript/google-maps": "file:../../packages/google-maps",
"@nativescript/google-maps-utils": "file:../../packages/google-maps-utils",
"@nativescript/jetpack-compose": "file:../../packages/jetpack-compose",
"@nativescript/animated-circle": "file:../../packages/animated-circle",
"@nativescript/appavailability": "file:../../packages/appavailability",
"@nativescript/apple-sign-in": "file:../../packages/apple-sign-in",
Expand All @@ -23,7 +26,6 @@
"@nativescript/facebook": "file:../../packages/facebook",
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
"@nativescript/geolocation": "file:../../packages/geolocation",
"@nativescript/google-maps": "file:../../packages/google-maps",
"@nativescript/google-signin": "file:../../packages/google-signin",
"@nativescript/haptics": "file:../../packages/haptics",
"@nativescript/imagepicker": "file:../../packages/imagepicker",
Expand Down
1 change: 1 addition & 0 deletions apps/demo/src/main-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Button text="fingerprint-auth" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="geolocation" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-maps" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-maps-utils" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-signin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="haptics" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="imagepicker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
Expand Down
12 changes: 12 additions & 0 deletions apps/demo/src/plugin-demos/google-maps-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Observable, EventData, Page } from '@nativescript/core';
import { DemoSharedGoogleMapsUtils } from '@demo/shared';
import { } from '@nativescript/google-maps-utils';

export function navigatingTo(args: EventData) {
const page = <Page>args.object;
page.bindingContext = new DemoModel();
}

export class DemoModel extends DemoSharedGoogleMapsUtils {

}
14 changes: 14 additions & 0 deletions apps/demo/src/plugin-demos/google-maps-utils.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:map="@nativescript/google-maps" navigatingTo="navigatingTo" class="page">
<Page.actionBar>
<ActionBar title="google-maps-utils" icon="" class="action-bar">
</ActionBar>
</Page.actionBar>
<StackLayout class="p-20">
<StackLayout>
<Button text="Test google-maps-utils" tap="{{ testIt }}" class="btn btn-primary"/>
<map:MapView
ready="{{ onMapReady }}"
/>
</StackLayout>
</StackLayout>
</Page>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@nativescript/types": "~8.5.0",
"@nativescript/webpack": "~5.0.5",
"@ngtools/webpack": "^15.0.0",
"@types/geojson": "^7946.0.10",
"@types/mkdirp": "^1.0.1",
"@types/sprintf-js": "^1.1.0",
"husky": "^8.0.0",
Expand Down
18 changes: 18 additions & 0 deletions packages/google-maps-utils/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "node_modules/**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
98 changes: 98 additions & 0 deletions packages/google-maps-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# @nativescript/google-maps-utils

```javascript
ns plugin add @nativescript/google-maps-utils
```
*Requires google maps plugin [@nativescript/google-maps](packages/google-maps/README.md)*

## Installation
Install the mixins to the GoogleMaps object
```javascript
import { installMixins } from '@nativescript/google-maps-utils';
installMixins();
```

## Usage
You can access the google maps utilities from the GoogleMaps object after the mixins have been installed.
```javascript
onMapReady(args: MapReadyEvent) {
const map = args.map;
}
```

---

## HeatMaps
```javascript
import { HeatmapTileProvider, HeatmapOptions } from '@nativescript/google-maps-utils';
import { GoogleMap, Coordinate } from '@nativescript/google-maps';

addHeatmapOverlay(map: GoogleMap, heatmapOptions: HeatmapOptions) {
// Create a new heat map tile provider
const heatmapProvider = new HeatmapTileProvider(heatmapOptions);
// Pass tile provider to Google Maps
const heatmapOverlay = map.addTileOverlay({
tileProvider: heatmapProvider,
});
}
```

### HeatmapOptions

| Property | Type
|:---------|:-----
| `coordinates` | `Coordinate[]`;
| `opacity` | `number`;
| `radius` | `number`;
| `maxIntensity` | `number`;
| `gradient` | ` IGradient[]`;

---

## Clustering
```javascript
import { ClusterManager } from '@nativescript/google-maps-utils';
import { GoogleMap, MarkerOptions } from '@nativescript/google-maps';

addClusteredMarkers(map: GoogleMap, markers: MarkerOptions[]) {
const clusterManager: ClusterManager = map.clusterManager(markers);
}
```

---

## Experimental Features
Features that are not yet fully implemented or likely to change.
### GeoJson Layers

Currently only supports GeoJson Objects.

```javascript
import { GeoJsonLayer, IGeometryStyle } from '@nativescript/google-maps-utils';

onMapReady(args: MapReadyEvent) {
const style: Partial<IGeometryStyle> = {
fillColor: new Color('blue'),
strokeColor: new Color('red'),
width: 4,
}

map.addGeoJson({
geoJson: geoJson,
style: style,
});
}
```

```javascript
import { GeoJsonLayer } from '@nativescript/google-maps-utils';

removeGeoJsonLayer(map: GoogleMap, layer: GeoJsonLayer) {
map.removeGeoJson(layer);
}
```


## License

Apache License Version 2.0
Loading