Styling fusion table markers with custom url icons? - google-maps-api-3

I want to style my fusion table markers based on a field in the fusion table. If I use default Google markers, the following code works:
layer = new google.maps.FusionTablesLayer({
query: {
select: 'bizCity',
from: '1yfyijoeC3GwDnnLutBI8IFOH8y2mfZ8LJGUDly4'
},
styles: [
{where: "'bizCatSub' = 'Antique & Classic Motorcycle Dealers'", markerOptions:{ iconName:"star"}}, // other landmarks
{where: "'bizCatSub' = 'Other moto business'", markerOptions:{ iconName:"wht_pushpin"}}, //businesses
{where: "'bizCatSub' = 'Shop'", markerOptions:{iconName:"red_blank"}}, //town houses
{where: "'bizCatSub' = '12'", markerOptions:{ iconName:"orange_blank"}}, //country homes
{where: "'bizCatSub' = '15'", markerOptions:{ iconName:"target"}},
]
});
layer.setMap(map);
You can see the jsfiddle here.
However, I want to use my own custom markers. To this end, I tried something like this:
layer = new google.maps.FusionTablesLayer({
query: {
select: 'bizCity',
from: '1yfyijoeC3GwDnnLutBI8IFOH8y2mfZ8LJGUDly4'
},
styles: [
{where: "'bizCatSub' = 'Antique & Classic Motorcycle Dealers'", markerOptions:{ url: "http://pollster.net/test/icons/dealer.png" }},
{where: "'bizCatSub' = 'Other moto business'", markerOptions:{ url: "http://pollster.net/test/icons/othermoto.png" }},
{where: "'bizCatSub' = 'Shop'", markerOptions:{ url: "http://pollster.net/test/icons/shop.png" }}
]
});
layer.setMap(map);
With the above code, the data shows up on the map, but it uses default markers instead of styling them as requested. Jsfiddle here. I looked at the documentation for styles and markeroptions and icons and tried different variations, but nothing is working for me. I think I'm missing something simple, but not sure what.
Anyone know what I'm missing?

Fusion Table Layer doesn't actually allow custom marker icons. This is a known issue: http://code.google.com/p/fusion-tables/issues/detail?id=69
However, there are some workarounds, probably the easiest of which was posted by a Google employee near the bottom of that thread just a few months ago: http://code.google.com/p/fusion-tables/issues/detail?id=69#c107
The gist of the workaround is that you'll no longer be using a FusionTableLayer, but instead be using javascript to grab the fusion table data and add custom markers yourself. It's a bit more code, but it does seem to work pretty well: https://googledrive.com/host/0B9htKoV1ZaKUU1g3ZnJCUWQyd28/customicons_viaApi.html

You cannot use your own custom icons with FusionTablesLayers, you can only use the ones that are defined by name (see here).
If you need to use your own and can take the performance hit of not using the FusionTablesLayer tile based rendering, you can query the table using either GViz or the Fusion Tables Query API to use Google Maps API v3 custom icons.
See this issue which has been marked "not-Feasible", but includes a work around.

Related

Google Analytics Embed API location view with secondary dimension

I'm trying to achieve the same thing as described in here:
Use Embed API to embed Google Analytics location map view
but I`m also interested in getting the secondary dimension (i.e. the table underneath the map).
Any snippets for fiddling with ?
The simplest way is to create another DataChart object and include that in your visualisation. For example:
var dataTable = new gapi.analytics.googleCharts.DataChart({
query: {
'ids': 'ga:1234',
'dimensions': 'ga:country',
'metrics': 'ga:sessions',
'start-date': '30daysAgo',
'end-date': 'yesterday',
},
chart: {
type: 'TABLE',
container: 'data-table'
}
});

Protractor e2e test fullcalendar drag & drop

I need to simulate a drag & drop on fullcalendar in the week view with protractor. I found something with coordinates but I'd like a "no browser window dependent solution"... ther's also no way out on finding the exact starting cell in the week view by class or id ...or at least, I couldn't figure how to select a single cell of a row of a day because, using the Chrome's item selector, it seems every row has the same class fc-widget-content and cells are not "selectable" elements.
Are there any other chances?
maybe this is a little bit helpful (also very later ;). I also want to test my app with FullCalendar, but I'm using Cypress (similar to Protractor).
We plan items from an external list and assign it to a resource on a certain day/time in the FullCalendar (we use the scheduler plugin).
I found out that the drag and drop event is somehow intercepted by code, enriching it with for example properties of the event (like date, title and others). How I enriched this data is in the Cypress trigger('drop', data) command. Data is the evenData that is set by the Draggable class:
// Executed on the external list items, where every item we want to plan has class `.fc-event`.
this.draggableContainer = new Draggable(this.containerEl.nativeElement, {
itemSelector: '.fc-event',
eventData(eventEl) {
const id = eventEl.dataset.id;
return {
duration,
id: currentWorkItem.id,
title: currentWorkItem.description,
extendedProps: {
duration,
customRender: true,
data: currentWorkItem,
},
};
}
Then, in your test file (Cypress)
const eventData = {
date: new Date(),
dateStr: new Date().toISOString(),
draggedEl: {
dataset: {
notificationId: '123',
priority: '0',
title: 'Test',
},
},
jsEvent: null,
resource: {
id: '123',
},
event: null,
oldEvent: null,
};
cy.get('.fc-event') // selector for the external event I want to drag in the calendar
.trigger('dragstart')
.get('.fc-time-grid table tr[data-time="07:00:00"] td.fc-widget-content:nth-child(2)') // selector for where I want to drop the event.
.trigger('drop', eventData) // this will fire the eventDrop event
So, .trigger('drop', eventData) will fill the eventDrop info. It is not exactly the same as doing it manually, but works for me.
Caveats:
I haven't found a way to plan it on another resource (we use the resource scheduling plugin of FullCalendar.io). It does not matter that much, because you can specify it in the evenData (resource: { id: 'my-resource-id' } }.
No visual feedback because the drag mirror is not shown. Not a big problem during e2e testing, but it is a bit of a blackbox now. Maybe this is fixable

When using Meteorjs' autoform, can I set a field allowing the user to take a photo?

In the schema declaration I have:
CollectionName.attachSchema(new SimpleSchema({
issue: {
type: String,
label: "Describe the issue you noticed",
max:256
},
location: {
label: "Place a marker on your approximate location",
type: String,
autoform: {
type: 'map',
afFieldInput: {
type: 'map',
autolocate: true,
zoom:16
}
}
}
I'd like to allow a user to take a picture on this insert form
{{> quickForm collection="CollectionName" id="inserttoCollection" type="insert"}}
I'd like to be able to let an individual not only document the location of an issue but take a picture of what issue was noticed.
My question: How do I set up a field properly so that it allows a user to take and upload a photo.
This is one of the areas where Meteor shines - isomorphic APIs that work across desktop and mobile browsers.
You'll want to meteor add mdg:camera, add a button to your form, and set its click handler to run MeteorCamera.getPicture().
Read more at https://github.com/meteor/mobile-packages/tree/master/packages/mdg:camera

Adding Firebase VAR to website

I setup and account at http://feedthefire.in and on Firebase dot com - to manage feeds I would liek to display on my site. I set everything up and the feeds get pulled into Firebase just like it should, now its time to add it to a web page...nothing, can't get the feeds to pull in from Firebase. I added the firebase.js reference in the header and in the body I placed
<script type="text/javascript">
var ref = new Firebase"'https://aodf.firebaseio.com");
ref.child("meta").once("value", function(snapshot) {
$("#e-title").html(snapshot.val().description);
});
ref.child("articles").limit(3).on("child_added", function(snapshot) {
var article = snapshot.val();
var link = $("<a>", {
"href": article.link,
"target": "_blank"
});
$("#e-list").append($("<li>").append(link.html(article.title)));
});
when you go to http://sandbox.studiorooster.com/ao I should see a list of feeds, but I don't, so I know I am supposed to place something else in the code; I think :)
There are a number of problems in what you posted above, each of which is explained below:
Syntax error on line #2: var ref = new Firebase("https://aodf.firebaseio.com");
You're loading a description on lines #3-5, but never rendering it, because there is no element with id e-title in the page you linked to. Trying adding <h2 id="e-title"></h2> to your template.
Similarly, you are loading a number of articles on lines #6-13, and trying to append each of these items to a list with id e-list, which also does not exist in your template. Try adding <ul id="e-list"></ul> to your template.
Hope that helps!

Wordpress Media Uploader Frame Multiple Item Selection Clear/Edit Tool

As part of a WP plugin I am creating, I am using Wordpress' Javascript/AJAX modal Uploader/gallery browser for multiple item selection. I am using this JS code;
file_frame = wp.media.frames.file_frame = wp.media({
multiple: true,
library: {
type: 'image'
},
});
This creates the frame as expected, but removes the left hand side bar, and the bottom edit/clear selection tool. Does anyone know how I can get these 2 things back?

Resources