Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 06-17-2016 07:16 PM
I can't seem to find an applicable UDF to convert base64 string or binary type to an ESRI equivalent geometry type. Can someone recommend a solution? I'm aware of Brandon Wilson's awesome article on HCC.
Created 06-18-2016 02:02 AM
solved with
add jar hdfs://namenode:8020/tmp/esri/esri-geometry-api.jar; add jar hdfs://namenode:8020/tmp/esri/spatial-sdk-hive-1.1.1-SNAPSHOT.jar; add jar hdfs://namenode:8020/tmp/esri/spatial-sdk-json-1.1.1-SNAPSHOT.jar; use default; create temporary function st_asgeojson as 'com.esri.hadoop.hive.ST_AsGeoJson'; select st_asgeojson(shape) from table;
Created 06-18-2016 12:50 AM
Hi @Artem Ervits, you are always on the cutting edge of new technologies! Regarding your question how about one of ST_*FromWKB functions, like for example ST_GeomFromWKB. There are more details about Well-known binary here.
Created 06-18-2016 01:17 AM
@Predrag Minovic I had the same train of thought though unfortunately I was not able to treat it as well known binary. The only way I was able to process it so far was either by base64 encoding it or using the ESRI JSON serialization, at which point I was still stuck. I may have to ingest the column in different format perhaps.
Created 06-18-2016 02:02 AM
solved with
add jar hdfs://namenode:8020/tmp/esri/esri-geometry-api.jar; add jar hdfs://namenode:8020/tmp/esri/spatial-sdk-hive-1.1.1-SNAPSHOT.jar; add jar hdfs://namenode:8020/tmp/esri/spatial-sdk-json-1.1.1-SNAPSHOT.jar; use default; create temporary function st_asgeojson as 'com.esri.hadoop.hive.ST_AsGeoJson'; select st_asgeojson(shape) from table;
Created 06-18-2016 02:25 AM
Glad to hear it works! By the way, what type is "shape"? According to docs: ST_AsGeoJson(geometry) return GeoJson representation of geometry.
Created 06-18-2016 02:52 AM
It is geometry in SQL Server and in Hive it is binary.
Created 06-19-2016 02:42 PM
a little update, function st_asgeojson only returns a JSON representation of geometry, to really make it useful, you still need to convert it to ST_Geometry type, with that object you can take full advantages of ESRI framework
create temporary function st_geomfromgeojson as 'com.esri.hadoop.hive.ST_GeomFromGeoJson'; select st_geomfromgeojson(st_asgeojson(shape)) from table;
Created 06-18-2016 06:11 PM
I can't wait to see this demo!