Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
ember-cli-g-maps
Advanced tools
Ember CLI G-Maps is a Google Map component for map driven applications.
A map driven application responds to map interactions with fresh data. What this means for the developer is that you will need consistent access to the state of the map as well as intuitive ways to efficiently render large amounts of data.
Ember-cli-g-maps seeks to give you the information you need, when you need it, so that you can make the necessary requests and render the most relevant map data for your users.
Built with the GMaps-For-Apps.js library, a fork of GMaps.
Supports:
In terminal:
ember install ember-cli-g-maps
This will install the ember-cli-g-maps
node module and the gmaps
bower component. The g-maps component will be available to your application, however you need to update your environment configuration to avoid violating the content security policy.
Update your config/environment.js
Content Security Policy to contain:
ENV.contentSecurityPolicy = {
'default-src': "'none'",
'script-src': "'self' 'unsafe-eval' *.googleapis.com maps.gstatic.com",
'font-src': "'self' fonts.gstatic.com",
'connect-src': "'self' maps.gstatic.com",
'img-src': "'self' *.googleapis.com maps.gstatic.com csi.gstatic.com",
'style-src': "'self' 'unsafe-inline' fonts.googleapis.com maps.gstatic.com"
};
You wont see your map unless it has height. In app/styles/app.css
:
.ember-cli-g-map {
height: 300px;
}
Simplest Possible G-Map
In your route:
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
lat: 32.75494243654723,
lng: -86.8359375,
zoom: 4
});
}
});
In your template:
{{g-maps name="my-map" lat=lat lng=lng zoom=zoom}}
Add Markers
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
markers: Ember.A([
{
id: 'unique-marker-id', // Recommended
lat: 33.516674497188255, // Required
lng: -86.80091857910156, // Required
infoWindow: {
content: '<p>Birmingham</p>',
visible: true
},
click: function(event, marker) {},
rightclick: function(event, marker) {},
dblclick: function(event, marker) {},
mouseover: function(event, marker) {},
mouseout: function(event, marker) {},
mouseup: function(event, marker) {},
mousedown: function(event, marker) {}
}
]);
});
}
});
{{g-maps ... markers=markers}}
Add Polygons
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
polygons: Ember.A([
{
id: 'unique-polygon-id', // Recommended
paths: [ // Required
[35.0041, -88.1955], // Lat, Lng
[31.0023, -84.9944], // Lat, Lng
[30.1546, -88.3864], // Lat, Lng
[34.9107, -88.1461] // Lat, Lng
],
click: function(event, polygon) {},
rightclick: function(event, polygon) {},
dblclick: function(event, polygon) {},
mouseover: function(event, polygon) {},
mouseout: function(event, polygon) {},
mouseup: function(event, polygon) {},
mousedown: function(event, polygon) {},
mousemove: function(event, polygon) {}
}
])
});
}
});
{{g-maps ... polygons=polygons}}
Add Polylines
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
polylines: Ember.A([
{
id: 'unique-polyline-id', // Recommended
strokeColor: 'blue',
strokeOpacity: 1,
strokeWeight: 6,
path: [ // Required
[34.220, -100.7], // Lat, Lng
[33.783, -92.81], // Lat, Lng
[35.946, -94.83], // Lat, Lng
[32.458, -95.71], // Lat, Lng
[33.783, -92.85] // Lat, Lng
],
click: function(event, polyline) {},
rightclick: function(event, polyline) {},
dblclick: function(event, polyline) {},
mouseover: function(event, polyline) {},
mouseout: function(event, polyline) {},
mouseup: function(event, polyline) {},
mousedown: function(event, polyline) {},
mousemove: function(event, polyline) {}
}
])
});
}
});
{{g-maps ... polylines=polylines}}
Add Circles
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
circles: Ember.A([
{
id: 'unique-circle-id', // Recommended
lat: 32.75494243654723, // Required
lng: -86.8359375, // Required
radius: 500000 // Not Required, but you'll probaby want to see it
click: function(event, circle) {},
rightclick: function(event, circle) {},
dblclick: function(event, circle) {},
mouseover: function(event, circle) {},
mouseout: function(event, circle) {},
mouseup: function(event, circle) {},
mousedown: function(event, circle) {},
mousemove: function(event, circle) {}
}
])
});
}
});
{{g-maps ... circles=circles}}
Add Rectangles
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
rectangles: Ember.A([
{
id: 'unique-rectangle-id', // Recommended
bounds: [
[40.300476079749465, -102.3046875], // lat, lng
[26.258936094468414, -73.828125] // lat, lng
],
strokeColor: 'green',
strokeOpacity: 1,
strokeWeight: 3,
fillColor: 'green',
fillOpacity: 0.2,
click: function(event, rectangle) {},
rightclick: function(event, rectangle) {},
dblclick: function(event, rectangle) {},
mouseover: function(event, rectangle) {},
mouseout: function(event, rectangle) {},
mouseup: function(event, rectangle) {},
mousedown: function(event, rectangle) {},
mousemove: function(event, rectangle) {}
}
])
});
}
});
{{g-maps ... rectangles=rectangles}}
Add Overlay
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
// Must be an Ember Array
overlays: Ember.A([
{
id: 'unique-overlay-id', // Recommended
lat: 32.75494243654723, // Required
lng: -86.8359375, // Required
content: '<strong class="my-class">Some HTML</strong>',
verticalAlign: 'top',
horizontalAlign: 'center',
click: function(event, overlay) {},
dblclick: function(event, overlay) {},
mouseup: function(event, overlay) {},
mousedown: function(event, overlay) {},
mouseover: function(event, overlay) {},
mousemove: function(event, overlay) {},
mouseout: function(event, overlay) {}
}
])
});
}
});
{{g-maps ... rectangles=rectangles}}
Add G-Map Component Events
export default Ember.Route.extend({
actions: {
onMapEvent: function(event) {
console.info('Click coordinate',
event.latLng.lat(), // Latitude
event.latLng.lng() // Longitude
);
console.info('Map boundaries',
event.bounds[0], // Northeast map coordinate
event.bounds[1] // Southwest map coordinate
);
console.info('Map\'s center',
this.controller.lat,
this.controller.lng
);
event.mapIdle.then(function() { // Promise
console.log('maps done loading tiles and user is not interacting with map');
});
event.mapTilesLoaded.then(function() { // Promise
console.log('Map tiles have finished loading');
});
}
}
});
{{g-maps ... click="onMapClick"}}
Set Map Type
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
lat: 32.75494243654723,
lng: -86.8359375,
mapType: 'satellite' // Accepts 'roadmap', 'satellite', 'hybrid', or 'terrain'
});
}
});
{{g-maps ... mapType=mapType}}
Set Draggable
export default Ember.Route.extend({
setupController: function(controller) {
controller.setProperties({
lat: 32.75494243654723,
lng: -86.8359375,
draggable: false // default = true
});
}
});
{{g-maps ... draggable=draggable}}
React to Map Loading Completion
export default Ember.Route.extend({
actions: {
onMapLoad: function(e) {
console.log(e.map +' has finished loading!');
// > "my-map has finished loading!"
}
}
});
{{g-maps name="my-map" loaded="onMapLoad"}}
{{g-maps
click="myClickAction"
bounds_changed="myBounds_changedAction"
center_changed="myCenter_changedAction"
dblclick="myDblclickAction"
drag="myDragAction"
dragend="myDragendAction"
dragstart="myDragstartAction"
heading_changed="myHeading_changedAction"
idle="myIdleAction"
maptypeid_changed="myMaptypeid_changedAction"
mousemove="myMousemoveAction"
mouseout="myMouseoutAction"
mouseover="myMouseoverAction"
projection_changed="myProjection_changedAction"
resize="myResizeAction"
rightclick="myRightclickAction"
tilesloaded="myTilesloadedAction"
tilt_changed="myTilt_changedAction"
zoom_changed="myZoom_changedAction"}}
Repurposed from the Google Maps Drawing Manager, Selections allow you to draw shapes on your map instance. This allows users to select areas on the map to interact with. Supported selection types include:
Selections Requirements
Selections requires the Google Maps Drawing library. To add this library in:
config/environment.js
add:
ENV.googleMap = {
libraries: ['drawing']
};
Main Configuration Property
Your g-maps component requires a truthy selections
property to be set in order to instantiate. The selections
object may contain the following:
Additional Configuration Properties
Actions Actions are fired when a selections are completed. Available selections actions are:
Selections Example
{{g-maps
...
selections=selections
selectionsDelay=delay
selectionsMode=activeMode
selectionsModes=supportedModes
selectionsPosition=position
selectionsMarker="onMarkerSelect"
selectionsCircle="onCircleSelect"
selectionsRectangle="onRectangleSelect"
selectionsPolygon="onPolygonSelect"
selectionsPolyline="onPolylineSelect"}}
Heatmap is an abstraction of the Google Maps Heatmap Layer.
Heatmap Requirements
Heatmap requires the Google Maps Visualization library. To add this library in:
config/environment.js
add:
ENV.googleMap = {
libraries: ['visualization']
};
Main Configuration Property
In config/environment.js
ENV.googleMap = {
// your configuration goes in here
libraries: ['places', 'geometry'], // milage varies based on g-maps supported features
version: '3', // not recommended
apiKey: 'your-unique-google-map-api-key'
}
The MIT License (MIT)
Copyright (c) 2015 Matt Jensen. github.com/Matt-Jensen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
An Ember CLI Addon for map driven applications
The npm package ember-cli-g-maps receives a total of 131 weekly downloads. As such, ember-cli-g-maps popularity was classified as not popular.
We found that ember-cli-g-maps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.