google.maps.MarkerShape not loaded - google-maps-api-3

I'm trying to create a MarkerShape object with google maps api (the last version, 3.9.2). Unfortunately, it seems that MarkerShape api is not loaded: here is what firebug's console shows me:
>>> google.maps.version
"3.9.2"
>>> google.maps.MarkerShape
undefined
Am I doing something wrong ? The last version of gmaps documentation for MarkerShape is here: https://developers.google.com/maps/documentation/javascript/reference#MarkerShape
Thx
Edit: here is an example on jsfiddle: http://jsfiddle.net/vszHk/6/ or just go to an official example like here https://google-developers.appspot.com/maps/documentation/javascript/examples/map-simple and open firebug

I think your problem is you are trying to treat google.maps.MarkerShape as a constructor. It's just an object, not a constructor.
So doing something like the following is wrong as there isn't a MarkerShape method in the google.maps object:
var marker_shape = new google.maps.MarkerShape();
To create a MarkerShape you can just create an object literal:
var marker_shape = {coords: [0,0,50,50], type: "rect"}
Then you can add this to the object literal you pass to the google.maps.Marker constructor. Eg.
marker = new google.maps.Marker({
position: lat_lng_object,
map: map,
shape: marker_shape
});

Given that 3.9.2 is the latest Nightly version, have you tried referring to an older more stable version, e.g. 3.9.1 or 3.8 (last Release version)
https://developers.google.com/maps/documentation/javascript/basics#Versioning
e.g. http://maps.googleapis.com/maps/api/js?v=3.8&sensor=false

Related

porting ipython widget to newer ipywidget API

I was trying to port the euroscipy2014 tutorial (which is also the base for the ipython cookbook) to the newer ipywidget API. I succesfully converted 3 of the 4 notebooks following the directions I found on the relative ipython documentation but i'm having troubles in porting the 3rd notebook (03_custom.ipynb).
I changed the js code from:
%%javascript
// We import the WidgetManager.
require(["widgets/js/widget"], function(WidgetManager){
// We define the NumberSelector view here.
var NumberSelector = widget.DOMWidgetView.extend({
// Function for rendering the view.
render: function(){
to:
%%javascript
// We import the WidgetManager.
require(["widget"], function(WidgetManager){
// We define the NumberSelector view here.
var NumberSelector = widget.DOMWidgetView.extend({
// Function for rendering the view.
render: function(){
using require(["widget”] … instead of require(["widgets/js/widget … and widget.DOMWidgetView.extend instead of IPython.DOMWidgetView.extend
but when testing the widget at the code cell 4 I have (log from the js console):
Couldn't create a view for model id '8727d6f51f804c7aa582b3d95b3c630d' -- Error: Class NumberSelector not found in registry (…)
I guess the last line in the js code:
WidgetManager.register_widget_view('NumberSelector', NumberSelector);
didn’t worked. (maybe .register_widget_view is no more a valid call).
Have you any idea on how to fix this? thanks!
I opened an issue here but i thought the proting of such API can be a topic of general interest, so i'm posting a question here as well.
https://github.com/rossant/euroscipy2014/issues/2

javascript google map v3 and data property missing

Trying to load a geojson result into my google map. According to the documentation ("Every Map has a Data object by default, so most of the time there is no need to construct one.") I can just do map.data.loadGeoJson. The problem is that there is no data property on map. So I tried to just create on by doing google.maps.Data(). Again Data is not a recognized type. This comes from documentation of version 3.16. Can anybody tell me what I am doing wrong? this is the url I use to reference map:
https://maps.googleapis.com/maps/api/js?libraries=visualization&sensor=false&language=en&v=3.16
It's a property of the google.maps.Map-instance:
var someMapInstance=new google.maps.Map(/*arguments*/);
//someMapInstance.data will be what you are looking for
console.log(someMapInstance.data);
Now it is showing up. I had recently changed my link from version 3.14 to 3.16 so maybe it just got stuck in cache though not sure how since the url was different but either way it is working now.

Objectify Ofy() is not finding the "query" method

I am new to objectify, and reading a tutorial on how to query. For some reason when I type the following code:
Query q = ofy().query(UserChoice.class).filter("email", email);
My Eclipse gives me a error saying "The method query(Class) is undefined for the type Objectify"
I'm not sure what this means? I imported Objectify correctly by using the following:
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
ObjectifyService.register(UserChoice.class);
Objective doesn't have an actual query method. In their API you can see all the calls you can make on the Objectify object, query() isn't one of those.
It looks like there may be an older version of Objectify that has a query method. The newest one (Build version: 4.0a3) doesn't have it, but an older version (Build version: 2.2.1) does. It looks like the class paths are the same, com.googlecode.objectify.Objectify. Make sure to load in the correct one or you are using the proper version with the `query() call.
The ObjectifyService you are using looks to be in the older version (2.2.1).

Firefox extension development sqlite

using Builder online tool
https://builder.addons.mozilla.org/
to build and test my extension
now that I want to store data locally I'm following this tutorial
https://developer.mozilla.org/en/Storage
but the code snippets are not working for me
Should I be developing them locally using the classic SDK or is there a way to add SQLite support to the Add-on builder ?
Add-on SDK is sandboxed by default and doesn't provide direct access to XPCOM. To use XPCOM objects you need to break out of the sandbox:
var {Cc, Ci, Cu} = require("chrome");
var {Services} = Cu.import("resource://gre/modules/Services.jsm");
var {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("ProfD", ["my_db_file_name.sqlite"]);
var mDBConn = Services.storage.openDatabase(file);
Note that Components stays undefined - use Cc instead of Components.classes, Ci instead of Components.interfaces and Cu instead of Components.utils.
You can use the simple JS wrapper: https://github.com/julianceballos/sqlite-jetpack

IvoryGoogleMap - can't display infoWindow

i'm trying to use IvoryGoogleMap to display a simple map with markers and infoWindows using this code:
$marker ->setPosition($place->getLat(), $place->getLng());
$infoWindow ->setContent('<p>Default content</p>');
$marker ->setInfoWindow($infoWindow);
$map ->addMarker($marker);
and all i'm getting is a map with marker(s) but when i click on one of them, nothing happens. Have you any idea what am i doing wrong ?
Ok, problem solved. Here is the solution from bundle's author egeloen (on github):
======================================================================
This functionality doesn't exist natively. If you want to open an info window with a click event on a marker, you need to use the ivory_google_map.event service. This service allow you to generate all events you want.
In your case, the event is :
$clickEvent = $this->get('ivory_google_map.event');
$clickEvent->setInstance($marker->getJavascriptVariable());
$clickEvent->setEventName('click');
$clickEvent->setHandle(sprintf('function(){%s.open(%s, %s);}',
$infoWindow->getJavascriptVariable(),
$map->getJavascriptVariable(),
$marker->getJavascriptVariable()
);
$map->getEventManager()->addEvent($clickEvent);

Resources