public void TestReadQuotedString2() { StringReader reader = new StringReader("\"Two words\".."); WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); string word=tokenizer.ReadDoubleQuotedWord(); Assertion.AssertEquals("test1","Two words",word); }
/// <summary> /// Creates the appropriate object given a string containing XML. /// </summary> /// <param name="wkt">String containing XML.</param> /// <returns>Object representation of the XML.</returns> /// <exception cref="ParseException">If a token is not recognised.</exception> public static object Create(string wkt) { object returnObject = null; StringReader reader = new StringReader(wkt); WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); tokenizer.NextToken(); string objectName=tokenizer.GetStringValue(); switch (objectName) { case "UNIT": IUnit unit = ReadUnit(tokenizer); returnObject = unit; break; case "VERT_DATUM": IVerticalDatum verticalDatum = ReadVerticalDatum(tokenizer); returnObject = verticalDatum; break; case "SPHEROID": IEllipsoid ellipsoid = ReadEllipsoid(tokenizer); returnObject = ellipsoid; break; case "TOWGS84": WGS84ConversionInfo wgsInfo = ReadWGS84ConversionInfo(tokenizer); returnObject = wgsInfo; break; case "DATUM": IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer); returnObject = horizontalDatum; break; case "PRIMEM": IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer); returnObject = primeMeridian; break; case "VERT_CS": IVerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer); returnObject = verticalCS; break; case "GEOGCS": IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); returnObject = geographicCS; break; case "PROJCS": IProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer); returnObject = projectedCS; break; case "COMPD_CS": ICompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer); returnObject = compoundCS; break; case "GEOCCS": case "FITTED_CS": case "LOCAL_CS": throw new NotSupportedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} is not implemented.",objectName)); default: throw new ParseException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0'} is not recongnized.",objectName)); } reader.Close(); return returnObject; }
public void TestReadAuthority1() { StringReader reader = new StringReader("AUTHORITY[\"EPSG\",\"9102\"]"); WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); Assertion.AssertEquals("test 1","EPSG",authority); Assertion.AssertEquals("test 2","9102",authorityCode); }
private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer) { /* PROJCS[ * "OSGB 1936 / British National Grid", * GEOGCS[ * "OSGB 1936", * DATUM[...] * PRIMEM[...] * AXIS["Geodetic latitude","NORTH"] * AXIS["Geodetic longitude","EAST"] * AUTHORITY["EPSG","4277"] * ], * PROJECTION["Transverse Mercator"], * PARAMETER["latitude_of_natural_origin",49], * PARAMETER["longitude_of_natural_origin",-2], * PARAMETER["scale_factor_at_natural_origin",0.999601272], * PARAMETER["false_easting",400000], * PARAMETER["false_northing",-100000], * AXIS["Easting","EAST"], * AXIS["Northing","NORTH"], * AUTHORITY["EPSG","27700"] * ] */ tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("GEOGCS"); IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); tokenizer.ReadToken(","); IProjection projection = ReadProjection(tokenizer); IAxisInfo axis0 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); tokenizer.ReadToken("AXIS"); IAxisInfo axis1 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); IAxisInfo[] axisArray = new IAxisInfo[2]; axisArray[0] = axis0; axisArray[1] = axis1; ILinearUnit linearUnit = LinearUnit.Meters; IProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null, axisArray, geographicCS, linearUnit, projection, "", authority, authorityCode, name, "", ""); return(projectedCS); }
private string GetNextCloser(WktStreamTokenizer tokenizer) { tokenizer.NextToken(); string nextWord = tokenizer.GetStringValue(); if (nextWord == ")") { return(nextWord); } throw new ParseException("Expected ')' but encountered '" + nextWord + "'"); }
private string GetNextEmptyOrOpener(WktStreamTokenizer tokenizer) { tokenizer.NextToken(); string nextWord = tokenizer.GetStringValue(); if ((nextWord == "EMPTY") || (nextWord == "(")) { return(nextWord); } throw new ParseException("Expected 'EMPTY' or '(' but encountered '" + nextWord + "'"); }
public void TestReadAuthority2() { StringReader reader = new StringReader("OPPS[\"EPSG\",\"9102\"]"); WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); string authority=""; string authorityCode=""; try { tokenizer.ReadAuthority(ref authority, ref authorityCode); } catch(ParseException) { } }
private static IAxisInfo ReadAxisInfo(WktStreamTokenizer tokenizer) { //AXIS["Geodetic longitude","EAST"] tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); string orientationString = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken("]"); AxisOrientation orientation = (AxisOrientation)Enum.Parse(typeof(AxisOrientation), orientationString, true); IAxisInfo axis = new AxisInfo(name, orientation); return(axis); }
private Point ReadPointText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_factory.createPoint(_factory.getCoordinateSequenceFactory().create(new Coordinate[] {}))); } Coordinate coord = new Coordinate(GetNextNumber(tokenizer), GetNextNumber(tokenizer)); _precisionModel.makePrecise(coord); this.GetNextCloser(tokenizer); return(_factory.createPoint(coord)); }
/// <summary> /// Creates a Point using the next token in the stream. /// </summary> /// <param name="tokenizer">Tokenizer over a stream of text in Well-known Text /// format. The next tokens must form a <Point Text>.</param> /// <returns>Returns a Point specified by the next token in /// the stream.</returns> /// <remarks> /// ParseException is thrown if an unexpected token is encountered. /// </remarks> private Point ReadPointText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_geometryFactory.CreatePoint(null)); } double x = GetNextNumber(tokenizer); double y = GetNextNumber(tokenizer); Coordinate externalCoordinate = new Coordinate(x, y); Coordinate internalCoordinate = new Coordinate(); _precisionModel.ToInternal(externalCoordinate, internalCoordinate); GetNextCloser(tokenizer); return(_geometryFactory.CreatePoint(internalCoordinate)); }
private static IProjection ReadProjection(WktStreamTokenizer tokenizer) { //tokenizer.NextToken();// PROJECTION tokenizer.ReadToken("PROJECTION"); tokenizer.ReadToken("["); //[ string projectionName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken("]"); //] tokenizer.ReadToken(","); //, tokenizer.ReadToken("PARAMETER"); ParameterList paramList = new ParameterList(); while (tokenizer.GetStringValue() == "PARAMETER") { tokenizer.ReadToken("["); string paramName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double paramValue = tokenizer.GetNumericValue(); tokenizer.ReadToken("]"); tokenizer.ReadToken(","); paramList.Add(paramName, paramValue); tokenizer.NextToken(); } ProjectionParameter[] paramArray = new ProjectionParameter[paramList.Count]; int i = 0; foreach (string key in paramList.Keys) { ProjectionParameter param = new ProjectionParameter(); param.Name = key; param.Value = (double)paramList[key]; paramArray[i] = param; i++; } string authority = ""; string authorityCode = ""; IProjection projection = new Projection(projectionName, paramArray, "", "", authority, authorityCode); return(projection); }
private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer) { /* * GEOGCS["OSGB 1936", * DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]] * PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]] * AXIS["Geodetic latitude","NORTH"] * AXIS["Geodetic longitude","EAST"] * AUTHORITY["EPSG","4277"] * ] */ tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("DATUM"); IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer); tokenizer.ReadToken("PRIMEM"); IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer); tokenizer.ReadToken("AXIS"); IAxisInfo axis0 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); tokenizer.ReadToken("AXIS"); IAxisInfo axis1 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); // ?? assume angular unit is degrees. IAngularUnit angularUnit = new AngularUnit(180 / Math.PI); IGeographicCoordinateSystem geographicCS = new GeographicCoordinateSystem(angularUnit, horizontalDatum, primeMeridian, axis0, axis1, "", authority, authorityCode, name, "", ""); return(geographicCS); }
private Coordinate[] GetCoordinates(WktStreamTokenizer tokenizer) { ArrayList coords = new ArrayList(); string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(new Coordinate[] {}); } do { Coordinate coord = new Coordinate(this.GetNextNumber(tokenizer), this.GetNextNumber(tokenizer)); _precisionModel.makePrecise(coord); coords.Add(coord); }while (this.GetNextCloserOrComma(tokenizer) == ","); return((Coordinate[])coords.ToArray(typeof(Coordinate))); }
private static IVerticalDatum ReadVerticalDatum(WktStreamTokenizer tokenizer) { //VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["5101","EPSG"]] tokenizer.ReadToken("["); string datumName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); string datumTypeNumber = tokenizer.GetStringValue(); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); DatumType datumType = (DatumType)Enum.Parse(typeof(DatumType), datumTypeNumber); IVerticalDatum verticalDatum = new VerticalDatum(datumType, "", authorityCode, authority, datumName, "", ""); tokenizer.ReadToken("]"); return(verticalDatum); }
private static IPrimeMeridian ReadPrimeMeridian(WktStreamTokenizer tokenizer) { //PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]] tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double longitude = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); // make an assumption about the Angular units - degrees. IPrimeMeridian primeMeridian = new PrimeMeridian(name, new AngularUnit(180 / Math.PI), longitude, "", authority, authorityCode, "", ""); tokenizer.ReadToken("]"); return(primeMeridian); }
private MultiLineString ReadMultiLineStringText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(new MultiLineString(new LineString[] {}, _factory)); } ArrayList lineStrings = new ArrayList(); lineStrings.Add(ReadLineStringText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { lineStrings.Add(ReadLineStringText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return(_factory.createMultiLineString((LineString[])lineStrings.ToArray(typeof(LineString)))); }
private MultiPolygon ReadMultiPolygonText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_factory.createMultiPolygon(new Polygon[] {})); } ArrayList polygons = new ArrayList(); polygons.Add(ReadPolygonText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { polygons.Add(ReadPolygonText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return(_factory.createMultiPolygon((Polygon[])polygons.ToArray(typeof(Polygon)))); }
private GeometryCollection ReadGeometryCollectionText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_factory.createGeometryCollection(new Geometry[] {})); } ArrayList geometries = new ArrayList(); geometries.Add(ReadGeometryTaggedText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { geometries.Add(ReadGeometryTaggedText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return(_factory.createGeometryCollection((Geometry[])geometries.ToArray(typeof(Geometry)))); }
/** * Creates a <code>MultiPolygon</code> using the next token in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <MultiPolygon Text>. *@return a <code>MultiPolygon</code> specified by the next * token in the stream, or if if the coordinates used to create the * <code>Polygon</code> shells and holes do not form closed linestrings. *@throws IOException if an I/O error occurs *@throws ParseException if an unexpected token was encountered */ private MultiPolygon ReadMultiPolygonText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_geometryFactory.CreateMultiPolygon(new Polygon[] {})); } ArrayList polygons = new ArrayList(); Polygon polygon = ReadPolygonText(tokenizer); polygons.Add(polygon); nextToken = GetNextCloserOrComma(tokenizer); while (nextToken == ",") { polygon = ReadPolygonText(tokenizer); polygons.Add(polygon); nextToken = GetNextCloserOrComma(tokenizer); } Polygon[] array = new Polygon[polygons.Count]; return(_geometryFactory.CreateMultiPolygon((Polygon[])polygons.ToArray(typeof(Polygon)))); }
/** * Creates a <code>GeometryCollection</code> using the next token in the * stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <GeometryCollection Text>. *@return a <code>GeometryCollection</code> specified by the * next token in the stream *@throws ParseException if the coordinates used to create a <code>Polygon</code> * shell and holes do not form closed linestrings, or if an unexpected * token was encountered *@throws IOException if an I/O error occurs */ private GeometryCollection ReadGeometryCollectionText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(_geometryFactory.CreateGeometryCollection(new Geometry[] {})); } ArrayList geometries = new ArrayList(); Geometry geometry = ReadGeometryTaggedText(tokenizer); geometries.Add(geometry); nextToken = GetNextCloserOrComma(tokenizer); while (nextToken == ",") { geometry = ReadGeometryTaggedText(tokenizer); geometries.Add(geometry); nextToken = GetNextCloserOrComma(tokenizer); } Geometry[] array = new Geometry[geometries.Count]; return(_geometryFactory.CreateGeometryCollection((Geometry[])geometries.ToArray(typeof(Geometry)))); }
private Polygon ReadPolygonText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return(new Polygon(new LinearRing(_factory.getCoordinateSequenceFactory().create(new Coordinate[] {}), _factory), new LinearRing[] {}, _factory)); } LinearRing shell = ReadLinearRingText(tokenizer); ArrayList holes = new ArrayList(); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { holes.Add(ReadLinearRingText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return(_factory.createPolygon(shell, (LinearRing[])holes.ToArray(typeof(LinearRing)))); }
/** * Creates a <code>MultiLineString</code> using the next token in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <MultiLineString Text>. *@return a <code>MultiLineString</code> specified by the * next token in the stream *@throws IOException if an I/O error occurs *@throws ParseException if an unexpected token was encountered */ private MultiLineString ReadMultiLineStringText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { //return geometryFactory.createMultiLineString(new LineString[]{}); return(new MultiLineString(new LineString[] {}, _precisionModel, _geometryFactory.SRID)); } ArrayList lineStrings = new ArrayList(); LineString lineString = ReadLineStringText(tokenizer); lineStrings.Add(lineString); nextToken = GetNextCloserOrComma(tokenizer); while (nextToken == ",") { lineString = ReadLineStringText(tokenizer); lineStrings.Add(lineString); nextToken = GetNextCloserOrComma(tokenizer); } LineString[] array = new LineString[lineStrings.Count]; return(_geometryFactory.CreateMultiLineString((LineString[])lineStrings.ToArray(typeof(LineString)))); }
/// <summary> /// Returns a IUnit given a piece of WKT. /// </summary> /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param> /// <returns>An object that implements the IUnit interface.</returns> private static IUnit ReadUnit(WktStreamTokenizer tokenizer) { //UNIT["degree",0.01745329251994433,AUTHORITY["EPSG","9102"]] IUnit unit = null; tokenizer.ReadToken("["); string unitName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double unitsPerUnit = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); switch (unitName) { // take into account the different spellings of the word meter/metre. case "meter": case "metre": unit = new LinearUnit(unitsPerUnit, "", authority, authorityCode, unitName, "", ""); break; case "degree": case "radian": unit = new AngularUnit(unitsPerUnit, "", authority, authorityCode, unitName, "", ""); break; default: throw new NotImplementedException(String.Format("{0} is not recognized a unit of measure.", unitName)); } return(unit); }
/* * /// <summary> * /// Creates an array of Points have the given Coordinates. * /// </summary> * /// <param name="coordinates">The Coordinates with which to create the Points.</param> * /// <returns>Returns a Point array created using this GeometryWKTReader's GeometryFactory.</returns> * private ArrayList ToPoints(ArrayList coordinates) * { * * ArrayList points = new ArrayList(); * for (int i = 0; i < coordinates.length; i++) { * points.add(geometryFactory.createPoint(coordinates[i])); * } * return (Point[]) points.ToArray(new Point[]{}); * * throw new NotImplementedException(); * } */ /// <summary> /// Creates a Polygon using the next token in the stream. /// </summary> /// <param name="tokenizer">Tokenizer over a stream of text in Well-known Text /// format. The next tokens must form a <Polygon Text>.</param> /// <returns>Returns a Polygon specified by the next token /// in the stream</returns> /// <remarks> /// ParseException is thown if the coordinates used to create the Polygon /// shell and holes do not form closed linestrings, or if an unexpected /// token is encountered. /// </remarks> private Polygon ReadPolygonText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { //return geometryFactory.createPolygon(geometryFactory.createLinearRing( // new Coordinate[]{}), new LinearRing[]{}); LinearRing linearRing = new LinearRing(new Coordinates(), _precisionModel, _geometryFactory.SRID); return(new Polygon(linearRing, _precisionModel, _geometryFactory.SRID)); } ArrayList holes = new ArrayList(); LinearRing shell = ReadLinearRingText(tokenizer); nextToken = GetNextCloserOrComma(tokenizer); while (nextToken == ",") { LinearRing hole = ReadLinearRingText(tokenizer); holes.Add(hole); nextToken = GetNextCloserOrComma(tokenizer); } LinearRing[] array = new LinearRing[holes.Count]; return(_geometryFactory.CreatePolygon(shell, (LinearRing[])holes.ToArray(typeof(LinearRing)))); }
private static WGS84ConversionInfo ReadWGS84ConversionInfo(WktStreamTokenizer tokenizer) { //TOWGS84[0,0,0,0,0,0,0] tokenizer.ReadToken("["); WGS84ConversionInfo info = new WGS84ConversionInfo(); tokenizer.NextToken(); info.Dx = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Dy = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Dz = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ex = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ey = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ez = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ppm = tokenizer.GetNumericValue(); tokenizer.ReadToken("]"); return(info); }
private static ICompoundCoordinateSystem ReadCompoundCoordinateSystem(WktStreamTokenizer tokenizer) { /* * COMPD_CS[ * "OSGB36 / British National Grid + ODN", * PROJCS[] * VERT_CS[] * AUTHORITY["EPSG","7405"] * ]*/ //TODO add a ReadCoordinateSystem - that determines the correct coordinate system to //read. Right now this hard coded for a projected and a vertical coord sys - so the UK //national grid works. tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); string headCSCode = tokenizer.GetStringValue(); ICoordinateSystem headCS = ReadCoordinateSystem(headCSCode, tokenizer); tokenizer.ReadToken(","); tokenizer.NextToken(); string tailCSCode = tokenizer.GetStringValue(); ICoordinateSystem tailCS = ReadCoordinateSystem(tailCSCode, tokenizer); tokenizer.ReadToken(","); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); ICompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCS, tailCS, "", authority, authorityCode, name, "", ""); return(compoundCS); }
private static IGeographicCoordinateSystem ReadGeographicCoordinateSystem(WktStreamTokenizer tokenizer) { /* GEOGCS["OSGB 1936", DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]] PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]] AXIS["Geodetic latitude","NORTH"] AXIS["Geodetic longitude","EAST"] AUTHORITY["EPSG","4277"] ] */ tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("DATUM"); IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer); tokenizer.ReadToken("PRIMEM"); IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer); tokenizer.ReadToken("AXIS"); IAxisInfo axis0 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); tokenizer.ReadToken("AXIS"); IAxisInfo axis1 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); // ?? assume angular unit is degrees. IAngularUnit angularUnit = new AngularUnit(180/Math.PI); IGeographicCoordinateSystem geographicCS = new GeographicCoordinateSystem(angularUnit, horizontalDatum, primeMeridian,axis0, axis1,"",authority,authorityCode,name,"",""); return geographicCS; }
private static IHorizontalCoordinateSystem ReadHorizontalCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException("IGeocentricCoordinateSystem is not implemented."); }
private MultiPoint ReadMultiPointText(WktStreamTokenizer tokenizer) { return(_factory.createMultiPoint(GetCoordinates(tokenizer))); }
private LineString ReadLineStringText(WktStreamTokenizer tokenizer) { return _factory.createLineString(GetCoordinates(tokenizer)); }
private static IHorizontalDatum ReadHorizontalDatum(WktStreamTokenizer tokenizer) { //DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]]TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6277"]] tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("SPHEROID"); IEllipsoid ellipsoid = ReadEllipsoid(tokenizer); tokenizer.ReadToken("TOWGS84"); WGS84ConversionInfo wgsInfo = ReadWGS84ConversionInfo(tokenizer); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); // make an assumption about the datum type. DatumType datumType = DatumType.IHD_Geocentric; IHorizontalDatum horizontalDatum = new HorizontalDatum(name,datumType,ellipsoid, wgsInfo,"",authority,authorityCode,"",""); tokenizer.ReadToken("]"); return horizontalDatum; }
private static IProjectedCoordinateSystem ReadProjectedCoordinateSystem(WktStreamTokenizer tokenizer) { /* PROJCS[ "OSGB 1936 / British National Grid", GEOGCS[ "OSGB 1936", DATUM[...] PRIMEM[...] AXIS["Geodetic latitude","NORTH"] AXIS["Geodetic longitude","EAST"] AUTHORITY["EPSG","4277"] ], PROJECTION["Transverse Mercator"], PARAMETER["latitude_of_natural_origin",49], PARAMETER["longitude_of_natural_origin",-2], PARAMETER["scale_factor_at_natural_origin",0.999601272], PARAMETER["false_easting",400000], PARAMETER["false_northing",-100000], AXIS["Easting","EAST"], AXIS["Northing","NORTH"], AUTHORITY["EPSG","27700"] ] */ tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("GEOGCS"); IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); tokenizer.ReadToken(","); IProjection projection = ReadProjection(tokenizer); IAxisInfo axis0 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); tokenizer.ReadToken("AXIS"); IAxisInfo axis1 = ReadAxisInfo(tokenizer); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); IAxisInfo[] axisArray = new IAxisInfo[2]; axisArray[0]=axis0; axisArray[1]=axis1; ILinearUnit linearUnit = LinearUnit.Meters; IProjectedCoordinateSystem projectedCS = new ProjectedCoordinateSystem(null,axisArray,geographicCS,linearUnit, projection,"",authority,authorityCode,name,"",""); return projectedCS; }
/// <summary> /// Returns a IUnit given a piece of WKT. /// </summary> /// <param name="tokenizer">WktStreamTokenizer that has the WKT.</param> /// <returns>An object that implements the IUnit interface.</returns> private static IUnit ReadUnit(WktStreamTokenizer tokenizer) { //UNIT["degree",0.01745329251994433,AUTHORITY["EPSG","9102"]] IUnit unit=null; tokenizer.ReadToken("["); string unitName=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double unitsPerUnit = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); switch (unitName) { // take into account the different spellings of the word meter/metre. case "meter": case "metre": unit = new LinearUnit(unitsPerUnit,"",authority,authorityCode,unitName,"",""); break; case "degree": case "radian": unit = new AngularUnit(unitsPerUnit,"",authority,authorityCode,unitName,"",""); break; default: throw new NotImplementedException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0} is not recognized a unit of measure.",unitName)); } return unit; }
/// <summary> /// Converts a Well-known Text representation to a <b>Geometry</b>. /// </summary> /// <param name="reader">A reader which contains a geometry tagged text string (see the OpenGIS Simple Features Specification).</param> /// <returns> /// Returns a <b>Geometry</b> read from the reader. An exception will be thrown if there is a /// parsing problem. /// </returns> public Geometry Create(TextReader reader) { WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); return(this.ReadGeometryTaggedText(tokenizer)); }
private static ICoordinateSystem ReadCoordinateSystem(string coordinateSystem, WktStreamTokenizer tokenizer) { ICoordinateSystem returnCS = null; switch (coordinateSystem) { case "VERT_CS": IVerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer); returnCS = verticalCS; break; case "GEOGCS": IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); returnCS = geographicCS; break; case "PROJCS": IProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer); returnCS = projectedCS; break; case "COMPD_CS": ICompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer); returnCS = compoundCS; break; case "GEOCCS": case "FITTED_CS": case "LOCAL_CS": throw new InvalidOperationException(String.Format("{0} coordinate system is not recongized.", coordinateSystem)); } return(returnCS); }
private LocalCoordinateSystem ReadLocalCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException(); }
private static IVerticalDatum ReadVerticalDatum(WktStreamTokenizer tokenizer) { //VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["5101","EPSG"]] tokenizer.ReadToken("["); string datumName=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); string datumTypeNumber = tokenizer.GetStringValue(); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); DatumType datumType = (DatumType)Enum.Parse(typeof(DatumType),datumTypeNumber); IVerticalDatum verticalDatum = new VerticalDatum(datumType,"",authorityCode,authority,datumName,"",""); tokenizer.ReadToken("]"); return verticalDatum; }
private static IVerticalCoordinateSystem ReadVerticalCoordinateSystem(WktStreamTokenizer tokenizer) { /* VERT_CS["Newlyn", VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]] UNIT["metre",1,AUTHORITY["EPSG","9001"]] AUTHORITY["EPSG","5701"] */ tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("VERT_DATUM"); IVerticalDatum verticalDatum = ReadVerticalDatum(tokenizer); tokenizer.ReadToken("UNIT"); IUnit unit = ReadUnit(tokenizer); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); IVerticalCoordinateSystem verticalCS = new VerticalCoordinateSystem(name,verticalDatum,"",authority,authorityCode,"",""); return verticalCS; }
// since the related objects have not been implemented private static IFittedCoordinateSystem ReadFittedCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException("IFittedCoordinateSystem is not implemented."); }
private static ICompoundCoordinateSystem ReadCompoundCoordinateSystem(WktStreamTokenizer tokenizer) { /* COMPD_CS[ "OSGB36 / British National Grid + ODN", PROJCS[] VERT_CS[] AUTHORITY["EPSG","7405"] ]*/ //TODO add a ReadCoordinateSystem - that determines the correct coordinate system to //read. Right now this hard coded for a projected and a vertical coord sys - so the UK //national grid works. tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); string headCSCode = tokenizer.GetStringValue(); ICoordinateSystem headCS = ReadCoordinateSystem(headCSCode,tokenizer); tokenizer.ReadToken(","); tokenizer.NextToken(); string tailCSCode = tokenizer.GetStringValue(); ICoordinateSystem tailCS = ReadCoordinateSystem(tailCSCode,tokenizer); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); ICompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCS,tailCS,"",authority,authorityCode,name,"",""); return compoundCS; }
private static IEllipsoid ReadEllipsoid(WktStreamTokenizer tokenizer) { //SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]] tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double majorAxis = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); double e = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); IEllipsoid ellipsoid = new Ellipsoid(majorAxis,0.0,e,true,LinearUnit.Meters,"",authority,authorityCode,name,"",""); return ellipsoid; }
private static IProjection ReadProjection(WktStreamTokenizer tokenizer) { //tokenizer.NextToken();// PROJECTION tokenizer.ReadToken("PROJECTION"); tokenizer.ReadToken("[");//[ string projectionName=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken("]");//] tokenizer.ReadToken(",");//, tokenizer.ReadToken("PARAMETER"); ParameterList paramList = new ParameterList(); while (tokenizer.GetStringValue()=="PARAMETER") { tokenizer.ReadToken("["); string paramName = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double paramValue = tokenizer.GetNumericValue(); tokenizer.ReadToken("]"); tokenizer.ReadToken(","); paramList.Add(paramName,paramValue); tokenizer.NextToken(); } ProjectionParameter[] paramArray = new ProjectionParameter[paramList.Count]; int i=0; foreach(string key in paramList.Keys) { ProjectionParameter param= new ProjectionParameter(); param.Name=key; param.Value=(double)paramList[key]; paramArray[i]=param; i++; } string authority=""; string authorityCode=""; IProjection projection = new Projection(projectionName, paramArray,"", "",authority, authorityCode); return projection; }
private static ICoordinateSystem ReadCoordinateSystem(string coordinateSystem, WktStreamTokenizer tokenizer) { ICoordinateSystem returnCS=null; switch (coordinateSystem) { case "VERT_CS": IVerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer); returnCS = verticalCS; break; case "GEOGCS": IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); returnCS = geographicCS; break; case "PROJCS": IProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer); returnCS = projectedCS; break; case "COMPD_CS": ICompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer); returnCS = compoundCS; break; case "GEOCCS": case "FITTED_CS": case "LOCAL_CS": throw new InvalidOperationException(String.Format("System.Globalization.CultureInfo.InvariantCulture, {0} coordinate system is not recongized.",coordinateSystem)); } return returnCS; }
private static IAxisInfo ReadAxisInfo(WktStreamTokenizer tokenizer) { //AXIS["Geodetic longitude","EAST"] tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); string orientationString = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken("]"); AxisOrientation orientation =(AxisOrientation) Enum.Parse(typeof(AxisOrientation),orientationString,true); IAxisInfo axis = new AxisInfo(name, orientation); return axis; }
private string GetNextWord(WktStreamTokenizer tokenizer) { TokenType type = tokenizer.NextToken(); string token = tokenizer.GetStringValue(); if (type == TokenType.Number) { throw new ParseException("Expected a number but got "+token); } else if (type == TokenType.Word) { return token.ToUpper(); } else if (token == "(") { return "("; } else if (token == ")") { return ")"; } else if (token == ",") { return ","; } throw new ParseException("Not a valid symbol in WKT format."); }
private static IPrimeMeridian ReadPrimeMeridian(WktStreamTokenizer tokenizer) { //PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]] tokenizer.ReadToken("["); string name=tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.NextToken(); double longitude = tokenizer.GetNumericValue(); tokenizer.ReadToken(","); string authority=""; string authorityCode=""; tokenizer.ReadAuthority(ref authority, ref authorityCode); // make an assumption about the Angular units - degrees. IPrimeMeridian primeMeridian = new PrimeMeridian(name,new AngularUnit(180/Math.PI),longitude,"",authority,authorityCode,"",""); tokenizer.ReadToken("]"); return primeMeridian; }
/// <summary> /// Creates the appropriate object given a string containing XML. /// </summary> /// <param name="wkt">String containing XML.</param> /// <returns>Object representation of the XML.</returns> /// <exception cref="ParseException">If a token is not recognised.</exception> public static object Create(string wkt) { object returnObject = null; StringReader reader = new StringReader(wkt); WktStreamTokenizer tokenizer = new WktStreamTokenizer(reader); tokenizer.NextToken(); string objectName = tokenizer.GetStringValue(); switch (objectName) { case "UNIT": IUnit unit = ReadUnit(tokenizer); returnObject = unit; break; case "VERT_DATUM": IVerticalDatum verticalDatum = ReadVerticalDatum(tokenizer); returnObject = verticalDatum; break; case "SPHEROID": IEllipsoid ellipsoid = ReadEllipsoid(tokenizer); returnObject = ellipsoid; break; case "TOWGS84": WGS84ConversionInfo wgsInfo = ReadWGS84ConversionInfo(tokenizer); returnObject = wgsInfo; break; case "DATUM": IHorizontalDatum horizontalDatum = ReadHorizontalDatum(tokenizer); returnObject = horizontalDatum; break; case "PRIMEM": IPrimeMeridian primeMeridian = ReadPrimeMeridian(tokenizer); returnObject = primeMeridian; break; case "VERT_CS": IVerticalCoordinateSystem verticalCS = ReadVerticalCoordinateSystem(tokenizer); returnObject = verticalCS; break; case "GEOGCS": IGeographicCoordinateSystem geographicCS = ReadGeographicCoordinateSystem(tokenizer); returnObject = geographicCS; break; case "PROJCS": IProjectedCoordinateSystem projectedCS = ReadProjectedCoordinateSystem(tokenizer); returnObject = projectedCS; break; case "COMPD_CS": ICompoundCoordinateSystem compoundCS = ReadCompoundCoordinateSystem(tokenizer); returnObject = compoundCS; break; case "GEOCCS": case "FITTED_CS": case "LOCAL_CS": throw new NotSupportedException(String.Format("{0} is not implemented.", objectName)); default: throw new ParseException(String.Format("'{0'} is not recongnized.", objectName)); } reader.Close(); return(returnObject); }
private MultiPoint ReadMultiPointText(WktStreamTokenizer tokenizer) { return _factory.createMultiPoint(GetCoordinates(tokenizer)); }
private MultiPolygon ReadMultiPolygonText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return _factory.createMultiPolygon(new Polygon[] {}); } ArrayList polygons = new ArrayList(); polygons.Add(ReadPolygonText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { polygons.Add(ReadPolygonText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return _factory.createMultiPolygon((Polygon[])polygons.ToArray(typeof(Polygon))); }
private Point ReadPointText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return _factory.createPoint(_factory.getCoordinateSequenceFactory().create(new Coordinate[] {})); } Coordinate coord = new Coordinate(GetNextNumber(tokenizer), GetNextNumber(tokenizer)); _precisionModel.makePrecise(coord); this.GetNextCloser(tokenizer); return _factory.createPoint(coord); }
// since the related objects have not been implemented private static IFittedCoordinateSystem ReadFittedCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException("IFittedCoordinateSystem is not implemented."); }
private Polygon ReadPolygonText(WktStreamTokenizer tokenizer) { string nextToken = GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return new Polygon(new LinearRing(_factory.getCoordinateSequenceFactory().create(new Coordinate[] {}), _factory), new LinearRing[] {}, _factory); } LinearRing shell = ReadLinearRingText(tokenizer); ArrayList holes = new ArrayList(); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { holes.Add(ReadLinearRingText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return _factory.createPolygon(shell, (LinearRing[])holes.ToArray(typeof(LinearRing))); }
private Geometry ReadGeometryTaggedText(WktStreamTokenizer tokenizer) { tokenizer.NextToken(); string type = tokenizer.GetStringValue().ToUpper(); switch (type) { case "POINT": return this.ReadPointText(tokenizer); case "LINESTRING": return this.ReadLineStringText(tokenizer); case "MULTIPOINT": return this.ReadMultiPointText(tokenizer); case "MULTILINESTRING": return this.ReadMultiLineStringText(tokenizer); case "POLYGON": return this.ReadPolygonText(tokenizer); case "MULTIPOLYGON": return this.ReadMultiPolygonText(tokenizer); case "GEOMETRYCOLLECTION": return this.ReadGeometryCollectionText(tokenizer); default: throw new ParseException(String.Format(System.Globalization.CultureInfo.InvariantCulture, "'{0}' is not WKT.", type)); } }
private MultiLineString ReadMultiLineStringText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return new MultiLineString(new LineString[] {}, _factory); } ArrayList lineStrings = new ArrayList(); lineStrings.Add(ReadLineStringText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { lineStrings.Add(ReadLineStringText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return _factory.createMultiLineString((LineString[])lineStrings.ToArray(typeof(LineString))); }
private LocalCoordinateSystem ReadLocalCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException(); }
private LocalDatum ReadLocalDatum(WktStreamTokenizer tokenizer) { throw new NotImplementedException(); }
private static IHorizontalCoordinateSystem ReadHorizontalCoordinateSystem(WktStreamTokenizer tokenizer) { throw new NotImplementedException("IGeocentricCoordinateSystem is not implemented."); }
private GeometryCollection ReadGeometryCollectionText(WktStreamTokenizer tokenizer) { string nextToken = this.GetNextEmptyOrOpener(tokenizer); if (nextToken == "EMPTY") { return _factory.createGeometryCollection(new Geometry[] {}); } ArrayList geometries = new ArrayList(); geometries.Add(ReadGeometryTaggedText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); while (nextToken == ",") { geometries.Add(ReadGeometryTaggedText(tokenizer)); nextToken = this.GetNextCloserOrComma(tokenizer); } return _factory.createGeometryCollection((Geometry[])geometries.ToArray(typeof(Geometry))); }
private LocalDatum ReadLocalDatum(WktStreamTokenizer tokenizer) { throw new NotImplementedException(); }
private static WGS84ConversionInfo ReadWGS84ConversionInfo(WktStreamTokenizer tokenizer) { //TOWGS84[0,0,0,0,0,0,0] tokenizer.ReadToken("["); WGS84ConversionInfo info = new WGS84ConversionInfo(); tokenizer.NextToken(); info.Dx=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Dy=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Dz=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ex=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ey=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ez=tokenizer.GetNumericValue(); tokenizer.ReadToken(","); tokenizer.NextToken(); info.Ppm=tokenizer.GetNumericValue(); tokenizer.ReadToken("]"); return info; }