Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Poly-Build produces polygon with invalid geography format

blyons
11 - Bolide

I use the spatial tools extensively to build polygons of radio station coverage which I store in a SQL Server database. I ran into a couple of situations where the attempt to insert into SQL Server produces an error:

Error: Output Data (68): DataWrap2ODBC::SendBatch: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]A .NET Framework error occurred during execution of user-defined routine or aggregate "geography": 
System.FormatException: 24115: The well-known binary (WKB) input is not valid.
System.FormatException: 
   at Microsoft.SqlServer.Types.WellKnownBinaryReader..ctor(SqlBytes bytes, GeoDataSink sink)
   at Microsoft.SqlServer.Types.SqlGeography.GeographyFromBinary(OpenGisType type, SqlBytes wkbGeography, Int32 srid)
.[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]The statement has been terminated. 

 

To test whether SQL Server was the problem, I also tried outputting the same data to a Tableau .hyper file, and got the error:

Error: Output Data (104): invalid geography format (valid well known text is required)
Context: 0x5fdfad59

 

Outputting to an Alteryx .yxdb works fine. I have not tried this with any other databases

 

In situations where the points forming the polygon are all the same point, the SpatialObj_Built output is null. But if the points forming the polygon are a line, the SpatialObj_Built output is not null, but does not contain a polygon either.

 

In the attached example, you will see 2 example locations, each with 3 records: one with a polygon, one with an error, and one null. I also show how you can use a Select tool to convert the spatial object to Well Known Text (WKT) to aid with diagnosis, as well as the Spatial Info tool. I also include the workaround to convert the empty object to null when this happens.

 

I believe this to be a bug with either the Poly-Build tool or the output to certain databases.

5 REPLIES 5
simon
11 - Bolide

hey Blyons,

 

This makes sense. filter your data on polygonID=127 - 94 and 501 - 97 and summarize like in screenshot. They all have the same lat/long per PolygonID.

so it's basically dropping 360 points on top of each other by polygon ID. There's no way to create a polygon that way. Hope this helps. 

 

polygon.png

blyons
11 - Bolide

I think you are saying the same thing I said. The problem is that Alteryx doesn't resolve the problem - they attempt to save an invalid polygon.

simon
11 - Bolide

I don't think this is a bug or Alteryx problem. It's a data issue. A polygon is created from a closed chain of polylines. And you can only create a polyline if you have more than one point which you don't seem to have. Could you split your data or add a formula field at the end: If polygon field is null, revert back to centroid field? Finally, you could also slightly tweak your lat long values (at the 8th decimal) then your latlongs would be different and you could create a very small polygon (which would probably appear to look like a point on the map).

blyons
11 - Bolide

I respectfully disagree.

 

You are correct that the data set in this example does not create a polygon. I said that in my original post. The problem is that Alteryx thinks it does and outputs an invalid spatial object that it successfully saves in a .yxdb and displays in a browse, but cannot save to other databases that expect valid objects. If Alteryx can properly handle cases where every point in the polygon is the same, which this example proves it does, then it should also properly handle cases where every point in the polygon except one is the same, which this example proves it does not. Bad data should never cause Alteryx to produce an invalid object without an error. The result should be null, or a different type of spatial object (e.g. a line), or an error should be raised.

 

My workaround solves the issue I am experiencing, but I still hold that this is a bug.

 

My main objective in posting this is to help others that encounter the same problem, since I searched the community for this error and found no hits whatsoever and subsequently struggled for several hours to identify the problem.

qw199505
7 - Meteor

We have something similar...
The issue is we have a flow that downloads NOAA storm data including shapes we integrate with our location data and report.

This has always worked but started failing a few days ago and we have determined the last record in a set for 1 of 6 storms seems to have a bad polygon.

It seems not to be one we made in relation to our property data but the polygons downloaded from NOAA.
Given this we do not know of a way to programmatically test the polygons we get from a 3rd party so we could exclude them.

As it is we fail Publishing to Tableau
Error: Publish to Tableau Server (173): TableauServer.OutputDataConditionally (248): Tool #44: invalid geography format (valid well known text is required)Context: 0x5fdfad59

We need a way to exclude the bad data so the flow can publish the good

Labels