0
votes

I am a developer trying to build a google data studio connector for people to connect to. The code handles other data types pretty well, but it seems to not work with Latitude,Longitude data types. Here is what I am currently doing to handle Latitude,Longitude datatype:

in getSchema():

var cc = DataStudioApp.createCommunityConnector();
var fields = cc.getFields();
var types = cc.FieldType;
fields.newDimension()
      .setId(id.toString())
      .setName(nameOfField)
      .setType(types.LATITUDE_LONGITUDE);

And in getData(), I simply return the string representation of Latitude, Longitude such as -1.123333, 1.12323 for each row.

This code works when I just view the geo data as a table such as follows: sample geo data in table form

However, when I try to plot these geo data in bubble map, I just get the plot of one single data point, as follows: bubble map (only see one point)

Any ideas of why this happens? I am getting the data correctly since the table form gives the right data, just don't know how to display all these geo data correctly? Or should I use a different type when I parse the schema for Latitude, Longitude?

Any help is greatly appreciated!

1
This probably has nothing to do with your connector or data type. Try to reproduce this behavior using Google Sheets to check what you're doing wrong. Also, notice the point you can see in the bubble map is one of your points in the table. - Diego Queiroz
Hello Diego! Thanks so much for the comment! This is a connector I am building to connect to a user database, so how can I check the behavior using Google Sheets? To do that I need to use connector to Google Sheets, not my connector, right? - Hugh Sun
Exactly, I suggested you to use Google Sheets standard connector indeed. I'm relatively sure your error isn't related with your data type, but without more detailed info, it is hard to tell. Since the data point you see in the bubble map is one row of your data, I would guess the problem is in getData and not in getFields. So my bet is that, if you mimic the wrong behavior in Google Sheets, it will be easier to understand what is wrong with your connector. - Diego Queiroz
Also, it would be great if you improve your answer with more information, like a copy of a dashboard that presents the problem (don't forget to set it publicly editable, so we can see check the settings). If you're not able to reproduce using Google Sheets, you can use hardcoded data points in your connector, so it won't depend on external sources to work. In short, since your problem involves several components (data source+connector+dashboard), try to make the smallest example that is enough to reproduce your problem. - Diego Queiroz

1 Answers

1
votes

This has been resolved, it turns out the points are malformed. For example, latitude, longitude = -122, 47 is simply not on the map because latitude can only range from -90 to 90. The issue is that the database returns the geo data in the form of longitude, latitude and GDS expects latitude, longitude. I flip the order in my data parsing step and it is working now!