Changeset 33925

Show
Ignore:
Timestamp:
14.02.2020 20:41:20 (4 days ago)
Author:
ak19
Message:

1. Bugfix: oversight, should return uri encoded URL for mapData, forgot to return modified string. Even with this correction, getting firefox screenshot of the full geojson still doesn't work with either the complex geojson or simple polygon shape, from command line or program.

Location:
other-projects/maori-lang-detection/src/org/greenstone/atea
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • other-projects/maori-lang-detection/src/org/greenstone/atea/CountryCodeCountsMapData.java

    r33919 r33925  
    629629        // Want to return encodeURIComponent(JSON.stringify(featuresGeojsonString)); 
    630630        // https://stackoverflow.com/questions/607176/java-equivalent-to-javascripts-encodeuricomponent-that-produces-identical-outpu 
    631         URLEncoder.encode(featuresGeojsonString); 
     631        featuresGeojsonString = URLEncoder.encode(featuresGeojsonString); 
     632         
    632633    } 
    633634    return featuresGeojsonString; 
     
    649650     
    650651    String mapURL = this.getAsMapURL(); 
    651  
    652     String mapURLescapedForBash = mapURL.replace("\"", "\\\"");//.replace("[", "\\[").replace("]", "\\]"); 
     652          ///String mapURLescapedForBash = .replace("\"", "\\\"");//.replace("[", "\\[").replace("]", "\\]"); 
     653 
     654    // Testing the geojson.io URL with a simpler polygon. Also doesn't work. 
     655    //String mapURL = GEOJSON_MAP_TOOL_URL + DATA_STR + URLEncoder.encode("{\"type\":\"Polygon\",\"coordinates\":[[[-77,37],[-77,38],[-76,38],[-76,37],[-77,37]]]}"); 
     656     
    653657     
    654658    File outputFile = new File(outputFolder + File.separator + fileNamePrefix+".png"); 
    655659    String outputFilePath = Utility.getFilePath(outputFile); 
    656660 
    657      
    658661    String[] cmdArgs = { 
    659662        "firefox", 
    660663        "--screenshot", 
    661664        outputFilePath, 
    662         mapURLescapedForBash //"'" + mapURL + "'" 
     665        mapURL //mapURLescapedForBash //"'" + mapURL + "'" 
    663666    }; 
    664      
     667 
     668     
     669    System.err.println(); 
    665670    System.err.print("Running:"); 
    666671    for(String arg : cmdArgs) { 
     
    673678    //String cmdArgs = "firefox --screenshot " + outputFilePath + " " + "'" + mapURL + "'"; 
    674679    //System.err.println("Running: " + cmdArgs); 
     680 
     681    System.err.println(); 
    675682     
    676683    SafeProcess proc = new SafeProcess(cmdArgs); 
  • other-projects/maori-lang-detection/src/org/greenstone/atea/SummaryTool.java

    r33924 r33925  
    439439            SafeProcess p = new SafeProcess(cmdArgs); 
    440440            int retVal = p.runProcess(); 
    441             logger.info("Json Validation tool returned with value: " + retVal); 
    442             logger.info("   std out: " + p.getStdOutput()); 
    443             logger.info("   std err: " + p.getStdError()); 
     441            logger.info("\nJson validation tool returned with value: " + retVal); 
     442            if(retVal == 0) { 
     443            logger.info("Valid geo json."); 
     444            } else { 
     445            logger.error("   std out: " + p.getStdOutput()); 
     446            logger.error("   std err: " + p.getStdError()); 
     447            logger.error("INVALID geo json generated. Not attempting screenshot of map."); 
     448            continue; 
     449            } 
    444450 
    445451