Changeset 33959 for other-projects


Ignore:
Timestamp:
2020-02-20T20:06:41+13:00 (4 years ago)
Author:
ak19
Message:

URIEncoding the mapData makes it unparseable by geojson.io

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

Legend:

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

    r33938 r33959  
    116116    static private final String DATA_STR = "#data=data:application/json,";
    117117   
    118     // "http://geojson.io" has a URL API to programmatically access
    119     /*
     118    /* "http://geojson.io" has a URL API to programmatically get it to generate
     119       a map from a geojson URL parameter.
     120
    120121       See http://geojson.io/ -> Help
    121122
     
    140141
    141142       http://geojson.io/#data=data:application/json,%7B%22type%22%3A%22LineString%22%2C%22coordinates%22%3A%5B%5B0%2C0%5D%2C%5B10%2C10%5D%5D%7D
     143
     144       The above uses JavaScript's encodeURIComponent(). Although partly different from
     145       URL.encode() in Java, it's not different in our case.
     146       However, using URL.encode() does end up producing a string that is not recognised by
     147       geojson.io's parser. Unencoded, the string is recognised fine.
    142148    */
    143149   
     
    635641        // https://stackoverflow.com/questions/607176/java-equivalent-to-javascripts-encodeuricomponent-that-produces-identical-outpu
    636642        featuresGeojsonString = URLEncoder.encode(featuresGeojsonString);
    637        
    638643    }
    639644    return featuresGeojsonString;
     
    641646
    642647    public String getAsMapURL() {
    643     boolean uriEncoded = true;
     648    // geojson.io advises to call JavaScript's encodeURIComponent() on the string
     649    // which for the geojson strings we're dealing with is the same as Java's URI.encode().
     650    // But uriEncoding our geojson produces a string unparseable by geojson.io,
     651    // whereas the unencoded string is recognised. Not sure why. Turning off uriEncoding.
     652    boolean uriEncoded = false;
    644653    String url = GEOJSON_MAP_TOOL_URL + DATA_STR + getFeaturesGeoJsonString(uriEncoded);
    645654
     
    682691    // https://bitsofco.de/using-a-headless-browser-to-capture-page-screenshots/
    683692    // https://developers.google.com/web/updates/2017/04/headless-chrome
     693
    684694   
    685695    String[] cmdArgs = {
  • other-projects/maori-lang-detection/src/org/greenstone/atea/ManualURLInspection.java

    r33952 r33959  
    5858    public static final String POEMS_OR_SONGS = "POEMS_OR_SONGS";
    5959    public static final String SINGLE_MRI_SENTENCE = "SINGLE_MRI_SENTENCE"; // TODO: REVIEW
    60     // TODO: ADD NEW String "POS_TITLES_OR_LINK_TEXT" for work designations and link text
     60    public static final String LINK_TEXT = "LINK_TEXT";
     61    // TODO: ADD NEW String "POS_TITLES_OR_LINK_TEXT" for office designations and link text
    6162
    6263   
Note: See TracChangeset for help on using the changeset viewer.