Skip to content

Commit

Permalink
Added -id= parameter to support downloading one changset.
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeoneElseOSM committed Jan 15, 2014
1 parent c93ba2a commit d9a41a4
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ Specifies a user's display name to search for changesets for. It will be URLenc
### -user=112
Specifies a user's userid to search for changesets for. Useful for when display names change, or when they contain characters that can't easily be passed from the command line.

### -id=37428
Specifies a changeset id to download. Use this instead of -display_name=, -user= or -time= to examine one specific changeset.

### -time="2013-11-04T20:53"
The time, specified in a way that the API will understand, to search for changesets from.

Expand Down
76 changes: 67 additions & 9 deletions src/Changeset1.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Changeset1
final static String param_output = "-output=";
final static String param_display_name = "-display_name=";
final static String param_uid = "-user=";
final static String param_id = "-id=";
final static String param_time = "-time=";
final static String param_dev = "-dev";
final static String param_debug = "-debug=";
Expand Down Expand Up @@ -1336,6 +1337,24 @@ static void process_time( String passed_time,
}


static void process_id( String passed_id,
String passed_min_lat_string, String passed_min_lon_string, String passed_max_lat_string, String passed_max_lon_string,
String passed_download_changeset, String passed_building, boolean passed_overlapnodes, String passed_download_nodes ) throws Exception
{
if ( arg_debug >= Log_Low_Routine_Start )
{
System.out.println( "process_id" );
}

URL url;
url = new URL( api_path + "changeset/" + passed_id );

process_changesets_url_common( url, "Any User", "",
passed_min_lat_string, passed_min_lon_string, passed_max_lat_string, passed_max_lon_string,
passed_download_changeset, passed_building, passed_overlapnodes, passed_download_nodes );
}


/**
* get_line_param
*
Expand Down Expand Up @@ -1397,6 +1416,7 @@ static String get_line_string_param( String passed_param, String passed_in_line
* param_output = "-output=";
* param_display_name = "-display_name=";
* param_uid = "-user=";
* param_id = "-id=";
* param_time = "-time=";
* param_dev = "-dev";
* param_debug = "-debug=";
Expand All @@ -1414,6 +1434,7 @@ public static void main(String[] args) throws Exception
{
String arg_display_name = "";
String arg_uid = "";
String arg_id = "";
String arg_time = "";

/* ------------------------------------------------------------------------------
Expand Down Expand Up @@ -1521,7 +1542,7 @@ public static void main(String[] args) throws Exception
} // -display_name

/* ------------------------------------------------------------------------------
* The user that we're interested in changesets for - userid
* The user that we're interested in changesets for - uid
* ------------------------------------------------------------------------------ */
if ( args[i].startsWith( param_uid ))
{
Expand All @@ -1534,6 +1555,20 @@ public static void main(String[] args) throws Exception
}
} // -uid

/* ------------------------------------------------------------------------------
* The changeset number that we're interested in changesets for - id
* ------------------------------------------------------------------------------ */
if ( args[i].startsWith( param_id ))
{
arg_id = args[i].substring( param_id.length() );

if ( arg_debug >= Log_Informational_2 )
{
System.out.println( "arg_id: " + arg_id );
System.out.println( "arg_id length: " + arg_id.length() );
}
} // -id

/* ------------------------------------------------------------------------------
* The time to start looking for changesets from
* ------------------------------------------------------------------------------ */
Expand Down Expand Up @@ -1770,19 +1805,29 @@ public static void main(String[] args) throws Exception
{
if ( arg_time.length() == 0 )
{
if ( arg_id.length() == 0 )
{
/* ------------------------------------------------------------------------------
* None of the parameters that we would have expect to have been passed were,
* so show the help screen, if we haven't already been asked to do so.
* ------------------------------------------------------------------------------ */
if ( arg_debug >= Log_Informational_2 )
{
System.out.println( "None of display_name, user or time passed" );
System.out.println( "" );
if ( arg_debug >= Log_Informational_2 )
{
System.out.println( "None of display_name, user, id or time passed" );
System.out.println( "" );
}

if ( arg_help == false )
{
show_help();
}
}

if ( arg_help == false )
{
show_help();
else
{ // We've been passed a specific changeset id
process_id( arg_id, arg_min_lat_string, arg_min_lon_string,
arg_max_lat_string, arg_max_lon_string,
arg_download_changeset, arg_building,
arg_overlapnodes, arg_download_nodes );
}
}
else
Expand Down Expand Up @@ -1864,6 +1909,7 @@ public static void main(String[] args) throws Exception
String in_line = "";
String line_display_name = "";
String line_uid = "";
String line_id = "";
String line_time = "";
String line_bbox = "";
String line_min_lat_string = "";
Expand Down Expand Up @@ -1906,6 +1952,18 @@ public static void main(String[] args) throws Exception
line_uid = arg_uid;
}

line_id = get_line_string_param( param_id, in_line );

if ( arg_debug >= Log_Informational_2 )
{
System.out.println( "line_id: " + line_id );
}

if ( line_id.equals( "" ))
{
line_id = arg_id;
}

line_time = get_line_string_param( param_time, in_line );

if ( arg_debug >= Log_Informational_2 )
Expand Down

0 comments on commit d9a41a4

Please sign in to comment.