Examples of WKTParser


Examples of ca.carleton.gcrc.geom.wkt.WktParser

  }

  public void outputExport(Writer writer) throws Exception {
    JSONWriter jsonWriter = new JSONWriter(writer);
    GeoJsonGeometryWriter geoWriter = new GeoJsonGeometryWriter();
    WktParser wktParser = new WktParser();
 
    jsonWriter.object();
   
    jsonWriter.key("type");
    jsonWriter.value("FeatureCollection");

    jsonWriter.key("features");
    jsonWriter.array();
   
    while( retrieval.hasNext() ){
      Document doc = retrieval.getNext();
      if( null != doc
       && docFilter.accepts(doc) ) {
        JSONObject jsonDoc = doc.getJSONObject();
       
        String schemaName = jsonDoc.optString("nunaliit_schema");
        if( null != schemaName ) {
          SchemaExportInfo exportInfo = schemaCache.getExportInfo(schemaName);
          if( null != exportInfo ){
            jsonWriter.object();
           
            jsonWriter.key("type");
            jsonWriter.value("Feature");

            jsonWriter.key("id");
            jsonWriter.value(doc.getId());
           
            jsonWriter.key("properties");
            jsonWriter.object();
           
            for(SchemaExportProperty exportProperty : exportInfo.getProperties()){
              Object value = exportProperty.select(jsonDoc);
              if( null != value ) {
                jsonWriter.key(exportProperty.getLabel());
                jsonWriter.value(value);
              }
            }
           
            jsonWriter.endObject(); // end properties
           
            if( JSONSupport.containsKey(jsonDoc, "nunaliit_geom") ) {
              JSONObject jsonGeom = jsonDoc.getJSONObject("nunaliit_geom");
              String wkt = jsonGeom.optString("wkt", null);
              if( null != wkt ){
                Geometry geometry = wktParser.parseWkt(wkt);
                jsonWriter.key("geometry");
                geoWriter.writeGeometry(jsonWriter, geometry);
              }
            }
           
View Full Code Here

Examples of ca.carleton.gcrc.geom.wkt.WktParser

  }

  public void outputExport(Writer writer) throws Exception {
    JSONWriter jsonWriter = new JSONWriter(writer);
    GeoJsonGeometryWriter geoWriter = new GeoJsonGeometryWriter();
    WktParser wktParser = new WktParser();
 
    jsonWriter.object();
   
    jsonWriter.key("type");
    jsonWriter.value("FeatureCollection");

    jsonWriter.key("features");
    jsonWriter.array();
   
    while( retrieval.hasNext() ){
      Document doc = retrieval.getNext();
      if( null != doc
       && docFilter.accepts(doc) ) {
        JSONObject jsonDoc = doc.getJSONObject();
       
        String schemaName = jsonDoc.optString("nunaliit_schema");
        if( null != schemaName ) {
          boolean containsGeometry = JSONSupport.containsKey(jsonDoc, "nunaliit_geom");
          SchemaExportInfo exportInfo = schemaCache.getExportInfo(schemaName);
         
          if( null != exportInfo || containsGeometry ){
            jsonWriter.object();
           
            jsonWriter.key("type");
            jsonWriter.value("Feature");

            jsonWriter.key("id");
            jsonWriter.value(doc.getId());
           
            jsonWriter.key("properties");
            jsonWriter.object();
           
            if( null != exportInfo ){
              for(SchemaExportProperty exportProperty : exportInfo.getProperties()){
                Object value = exportProperty.select(jsonDoc);
                if( null != value ) {
                  jsonWriter.key(exportProperty.getLabel());
                  jsonWriter.value(value);
                }
              }
            }
           
            jsonWriter.endObject(); // end properties
           
            if( containsGeometry ) {
              JSONObject jsonGeom = jsonDoc.getJSONObject("nunaliit_geom");
              String wkt = jsonGeom.optString("wkt", null);
              if( null != wkt ){
                Geometry geometry = wktParser.parseWkt(wkt);
                jsonWriter.key("geometry");
                geoWriter.writeGeometry(jsonWriter, geometry);
              }
            }
           
View Full Code Here

Examples of org.geotools.geometry.text.WKTParser

                        }
                        else { // try parsing this thing as WKT
                          GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
                            GeometryFactory geomFact = builder.getGeometryFactory();
                            PrimitiveFactory primFact = builder.getPrimitiveFactory();
                            WKTParser wktFactory = new WKTParser(geomFact, primFact, null, builder.getAggregateFactory());
                            try {
                                Object expectedResult = wktFactory.parse(operationValue);
                                op.setExpectedResult(expectedResult);
                                testCase.addTestOperation(op);
                            } catch (ParseException e) {
                                e.printStackTrace();
                            }
View Full Code Here

Examples of org.geotools.geometry.text.WKTParser

        }

        GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
        GeometryFactory geomFact = builder.getGeometryFactory();
        PrimitiveFactory primFact = builder.getPrimitiveFactory();
        wktFactory = new WKTParser( geomFact, primFact, null, builder.getAggregateFactory() );
    }
View Full Code Here

Examples of org.geotools.geometry.text.WKTParser

                        }
                        else { // try parsing this thing as WKT
                          GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
                            GeometryFactory geomFact = builder.getGeometryFactory();
                            PrimitiveFactory primFact = builder.getPrimitiveFactory();
                            WKTParser wktFactory = new WKTParser(geomFact, primFact, null, builder.getAggregateFactory());
                            try {
                                Object expectedResult = wktFactory.parse(operationValue);
                                op.setExpectedResult(expectedResult);
                                testCase.addTestOperation(op);
                            } catch (ParseException e) {
                                e.printStackTrace();
                            }
View Full Code Here

Examples of org.geotools.geometry.text.WKTParser

        }

        GeometryFactory geomFact = new GeometryFactoryImpl(DefaultGeographicCRS.WGS84);
        PrimitiveFactory primFact = new PrimitiveFactoryImpl(DefaultGeographicCRS.WGS84);
        PositionFactory posFact = null;
        wktFactory = new WKTParser(geomFact, primFact, posFact, null );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.