Accessing Geometry via JDBC


#1

Hi All,

Forgive my ignorance - I am new to MapD - but I am failing with the following code:-

String sql = “SELECT mapd_geo from mapd_countries”;
ResultSet rs = stmt.executeQuery(sql);

	while (rs.next()) {
		Object mapd_geo = rs.getObject("mapd_geo") ;

	}

	rs.close();

I am getting the following error:-

“Exception in thread “main” java.lang.AssertionError: MULTIPOLYGON”

Is there some form of cast that I need to perform? Any workarounds?

Regards,

Jonathan


#2

Hi @jonrmayer,

I confirmed the error you are encountering when querying mapd_geo columns using JDBC, this issue will be fixed in an upcoming release.
In the meantime, you can access the mapd_geo data (point, linestring, and multi polygon) using Javascript library. Refer to the documentation for the explanation on the sample code.

Regards,
Veda