public long create ( final String name , final GpsTraceDetails . Visibility visibility , final String description , final List < String > tags , final Iterable < GpsTrackpoint > trackpoints ) { checkFieldLength ( "Name" , name ) ; checkFieldLength ( "Description" , description ) ; checkTagsLength ( tags ) ; /* * uploading a new GPX trace works with a multipart/form-data HTML form, we need to cobble * together a valid request ourselves here which is why this is a little bit more complex * than specifying the parameters simply as URL parameters. But it is not so much more * complex, see FormDataWriter class and * http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 */ FormDataWriter writer = new FormDataWriter ( ) { @ Override protected void write ( ) throws IOException { ApiRequestWriter trackWriter = new GpxTrackWriter ( osm . getUserAgent ( ) , trackpoints ) ; addFileField ( "file" , name , trackWriter ) ; if ( tags != null && ! tags . isEmpty ( ) ) addField ( "tags" , toCommaList ( tags ) ) ; addField ( "description" , description ) ; addField ( "visibility" , visibility . toString ( ) . toLowerCase ( Locale . UK ) ) ; } } ; return osm . makeAuthenticatedRequest ( GPX + "/create" , "POST" , writer , new IdResponseReader ( ) ) ; }
Upload a new trace of trackpoints .