Hugh Sun
Hugh Sun

Reputation: 11

How to build google data studio connector to support visualization of geo data

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!

Upvotes: 0

Views: 212

Answers (1)

Hugh Sun
Hugh Sun

Reputation: 11

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!

Upvotes: 1

Related Questions