public static string ToWKT(this Esri.FileGDB.ShapeBuffer geometry) { try { string retval = ""; var shapeType = (ShapeType)geometry.shapeType; //note: "M" values are not really supported. Relevant geometries are handled to extract Z values, if present. switch (shapeType) { case ShapeType.Multipoint: case ShapeType.MultipointZ: case ShapeType.MultipointZM: MultiPointShapeBuffer mptbuff = geometry; retval = processMultiPointBuffer(mptbuff); break; case ShapeType.Point: case ShapeType.PointZ: case ShapeType.PointZM: PointShapeBuffer pt = geometry; retval = processPointBuffer(geometry); break; case ShapeType.Polyline: case ShapeType.PolylineZ: case ShapeType.PolylineZM: MultiPartShapeBuffer lbuff = geometry; retval = processMultiPartBuffer(lbuff, "MULTILINESTRING"); break; case ShapeType.Polygon: case ShapeType.PolygonZ: case ShapeType.PolygonZM: MultiPartShapeBuffer pbuff = geometry; retval = processMultiPartBuffer(pbuff, "MULTIPOLYGON"); break; } return(retval); } catch (Exception ex) { throw new Exception("Error processing geometry", ex); } }
private static string processPointBuffer(PointShapeBuffer buffer) { try { string retval = "POINT ({0})"; bool hasZ = false; try { hasZ = (buffer.Z != null); } catch { hasZ = false; } string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y); retval = string.Format(retval, coord); return(retval); } catch (Exception ex) { throw new Exception("Error processing point buffer", ex); } }
private static string processPointBuffer(PointShapeBuffer buffer) { try { StringBuilder retval = new StringBuilder("{\"type\":\"Point\", \"coordinates\": "); bool hasZ = false; try { hasZ = (buffer.Z != null); //this should always be true because a double is never null, but API throws and exception if no Z. } catch { hasZ = false; } string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y); retval.Append(coord); retval.Append("}"); return retval.ToString(); } catch (Exception ex) { throw new Exception("Error processing point buffer", ex); } }
private static string processPointBuffer(PointShapeBuffer buffer) { try { string retval = "POINT ({0})"; bool hasZ = false; try { hasZ = (buffer.Z != null); } catch { hasZ = false; } string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y); retval = string.Format(retval, coord); return retval; } catch (Exception ex) { throw new Exception("Error processing point buffer", ex); } }
private static IMapPoint ToGeneralPoint(PointShapeBuffer point) { var pointGeo = new GeometryFactory().CreatePoint(point.point.x, point.point.y); return(pointGeo); }
private static IMapPoint ToGeneralPoint(PointShapeBuffer point) { var pointGeo = new GeometryFactory().CreatePoint(point.point.x, point.point.y); return pointGeo; }
private static string processPointBuffer(PointShapeBuffer buffer) { string retval = "{\"type\":\"Point\", \"coordinates\": "; retval += getCoordinate(buffer.point.x, buffer.point.y) + "}"; return retval; }
private static string processPointBuffer(PointShapeBuffer buffer) { try { StringBuilder retval = new StringBuilder("{\"type\":\"Point\", \"coordinates\": "); bool hasZ = false; try { hasZ = (buffer.Z != null); //this should always be true because a double is never null, but API throws and exception if no Z. } catch { hasZ = false; } string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y); retval.Append(coord); retval.Append("}"); return retval.ToString(); } catch (Exception ex) { throw new Exception("Error processing point buffer", ex); } }
private static string processPointBuffer(PointShapeBuffer buffer) { string retval = "POINT ({0})"; bool hasZ = false; try { hasZ = (buffer.Z != null); } catch { hasZ = false; } string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y); retval += string.Format(retval, coord); return retval; }