Polygon exported to WKB with "wkbExportDefaults" has type of multipolygon
See original GitHub issueOperatorExportToWkbLocal doesn’t properly handle wkbExportDefaults - exported WKB has “multipolygon” (6) type written instead of “polygon” (3).
Here is reproducible example:
package ljader.test;
import java.nio.ByteBuffer;
import com.esri.core.geometry.OperatorExportToWkb;
import com.esri.core.geometry.Polygon;
import com.esri.core.geometry.WkbExportFlags;
public class WkbExportPolygonWrongType {
public static void main(String[] args) {
ByteBuffer byteBuffer = OperatorExportToWkb.local().execute(WkbExportFlags.wkbExportDefaults, createPolygon1(), null);
// WKB Polygon type is 3
System.out.println(byteBuffer.getInt(1)); // outputs 6
}
public static Polygon createPolygon1() {
Polygon poly = new Polygon();
poly.startPath(0, 0);
poly.lineTo(10, 10);
poly.lineTo(0, 10);
poly.lineTo(0, 0);
return poly;
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Export polygon from shapefile as type - qgis
Run Multipart to Singleparts from the processing toolbox, then export the result as GeoJSON.
Read more >Well-Known Binary (WKB) - GEOS
Standard WKB supports two-dimensional geometry, and is a proper subset of both extended WKB and ISO WKB. Data Types. The WKB specification uses...
Read more >wkb: Convert Between Spatial Objects and Well-Known Binary ...
Supported WKB geometry types are Point, LineString, Polygon, MultiPoint, MultiLineString, and. MultiPolygon. All elements in the list must have ...
Read more >more about Spatial SQL: WKT and WKB - SpatiaLite Cookbook
SpatiaLite supports a Geometry data type conformant to the ... two polygons: the first one has an interior ring ... MULTIPOLYGON .
Read more >Casting Polygons As Multipolygons? - Google Groups
recovered, since they have type mismatches. Because of this no export to shapefile is possible. I was hoping the MultiPolygonFromWKB fx would accept...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ljader Thank you, I’ve submitted a PR to fix the typo: https://github.com/Esri/geometry-api-java/pull/171. There is no bug I think, but the typo is misleading.
@stolstov thank you for the tip.
Side note: there is a typo / wrong import of WKT flags here: https://github.com/Esri/geometry-api-java/blob/master/src/main/java/com/esri/core/geometry/OperatorExportToWkbLocal.java#L173